home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Tool Chest / Dev.CD Feb 97 TC.toast / Sample Code / Development Tools & Languages / AppsToGo / •AppsToGo Reference / •AppsToGo Reference.rsrc / WFMT_531_a271 < prev    next >
Unknown  |  1994-09-22  |  16.7 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text


This file was not able to be converted.
This format is not currently supported by dexvert.

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert Jesper Olsen Module (music/jesperOlsen) magic Supported
1% dexvert TTComp Archive (archive/ttcomp) fallback Supported
100% file TTComp archive data, binary, 2K dictionary default (weak)
99% file data default
100% TrID TTComp archive compressed (bin-2K) default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 05 00 01 00 00 00 1a | 00 00 00 00 00 00 00 1a |........|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 05 00 05 00 00 |........|........|
|00000030| 00 22 00 00 00 00 00 00 | 00 22 61 32 37 31 00 00 |."......|."a271..|
|00000040| 4e 16 00 00 20 19 00 00 | 00 00 00 00 00 00 00 00 |N... ...|........|
|00000050| 00 00 08 4e 65 77 4c 61 | 79 65 72 00 00 06 00 00 |...NewLa|yer.....|
|00000060| 00 00 00 db 00 00 00 00 | 00 00 00 db 00 00 00 14 |........|........|
|00000070| 03 c1 00 28 05 7e 00 ff | 00 00 00 00 00 00 0f a8 |...(.~..|........|
|00000080| 00 00 00 00 4e 1c 00 00 | 00 09 00 00 00 04 00 04 |....N...|........|
|00000090| ff fc ff fa 00 04 00 04 | ff fc ff fc 00 00 00 00 |........|........|
|000000a0| 00 00 00 00 83 00 0b 40 | 10 6b 53 63 72 65 65 6e |.......@|.kScreen|
|000000b0| 41 50 49 2f 31 39 39 39 | 36 00 06 47 65 6e 65 76 |API/1999|6..Genev|
|000000c0| 61 00 00 81 4f 53 45 72 | 72 20 4e 65 77 4c 61 79 |a...OSEr|r NewLay|
|000000d0| 65 72 28 4c 61 79 65 72 | 4f 62 6a 20 2a 6e 65 77 |er(Layer|Obj *new|
|000000e0| 4c 61 79 65 72 2c 20 4c | 61 79 65 72 4f 62 6a 20 |Layer, L|ayerObj |
|000000f0| 61 62 6f 76 65 4c 61 79 | 65 72 2c 20 4c 61 79 65 |aboveLay|er, Laye|
|00000100| 72 50 72 6f 63 20 74 68 | 65 50 72 6f 63 2c 20 47 |rProc th|eProc, G|
|00000110| 72 61 66 50 74 72 20 62 | 61 73 65 50 6f 72 74 2c |rafPtr b|asePort,|
|00000120| 20 73 68 6f 72 74 20 64 | 65 70 74 68 2c 20 75 6e | short d|epth, un|
|00000130| 73 69 67 6e 65 64 20 6c | 6f 6e 67 20 74 68 65 44 |signed l|ong theD|
|00000140| 61 74 61 29 3b 00 00 00 | 06 00 00 00 00 00 8a 00 |ata);...|........|
|00000150| 00 00 00 00 00 00 8a 00 | 00 00 00 03 c1 00 14 05 |........|........|
|00000160| 7e 00 ff 00 00 00 00 00 | 00 0f a8 00 00 00 00 4e |~.......|.......N|
|00000170| 1d 00 00 00 09 00 00 00 | 04 00 04 ff fc ff fa 00 |........|........|
|00000180| 04 00 04 ff fc ff fc 00 | 00 00 00 00 00 00 00 83 |........|........|
|00000190| 00 0b 40 14 6b 53 63 72 | 65 65 6e 4f 6e 65 4c 69 |..@.kScr|eenOneLi|
|000001a0| 6e 65 2f 31 39 39 39 37 | 00 06 47 65 6e 65 76 61 |ne/19997|..Geneva|
|000001b0| 00 00 2c 43 72 65 61 74 | 65 20 61 20 6c 61 79 65 |..,Creat|e a laye|
|000001c0| 72 20 6f 62 6a 65 63 74 | 20 66 6f 72 20 6f 66 66 |r object| for off|
|000001d0| 73 63 72 65 65 6e 20 64 | 72 61 77 69 6e 67 2e 00 |screen d|rawing..|
|000001e0| 00 00 06 00 00 00 00 00 | 44 00 00 00 00 00 00 00 |........|D.......|
|000001f0| 44 00 00 00 00 02 6b 04 | 40 02 6c 01 00 00 00 00 |D.....k.|@.l.....|
|00000200| 00 00 01 0f f1 00 00 00 | 00 00 00 00 00 00 0c 00 |........|........|
|00000210| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000230| 00 00 00 00 00 00 06 00 | 00 00 00 00 b9 00 00 00 |........|........|
|00000240| 00 00 00 00 b9 00 00 00 | 00 02 6b 02 28 03 c1 00 |........|..k.(...|
|00000250| ff 00 00 00 00 00 00 0f | a8 00 00 00 00 4e 16 00 |........|.....N..|
|00000260| 00 00 09 00 00 00 04 00 | 04 ff fc ff fa 00 04 00 |........|........|
|00000270| 04 ff fc ff fc 00 00 00 | 00 00 00 00 00 83 00 0b |........|........|
|00000280| 40 0b 6c 69 6e 6b 73 2f | 31 39 39 39 30 00 06 4d |@.links/|19990..M|
|00000290| 6f 6e 61 63 6f 00 00 4e | 61 31 42 38 2c 44 69 73 |onaco..N|a1B8,Dis|
|000002a0| 70 6f 73 65 54 68 69 73 | 41 6e 64 42 65 6c 6f 77 |poseThis|AndBelow|
|000002b0| 4c 61 79 65 72 73 0d 61 | 32 35 38 2c 49 6e 76 61 |Layers.a|258,Inva|
|000002c0| 6c 4c 61 79 65 72 0d 61 | 32 37 31 2c 4e 65 77 4c |lLayer.a|271,NewL|
|000002d0| 61 79 65 72 0d 61 32 45 | 30 2c 55 70 64 61 74 65 |ayer.a2E|0,Update|
|000002e0| 4c 61 79 65 72 0d 00 16 | 00 01 00 00 00 00 00 10 |Layer...|........|
|000002f0| 00 0c 00 01 00 00 00 00 | 00 00 00 00 00 00 00 06 |........|........|
|00000300| 00 00 00 00 3f 9c 00 00 | 00 00 00 00 3f 9c 00 00 |....?...|....?...|
|00000310| 00 00 00 00 75 30 02 6b | 01 ff 00 00 00 00 00 00 |....u0.k|........|
|00000320| 0f a8 00 00 00 00 4e 1f | 00 00 00 09 00 00 00 04 |......N.|........|
|00000330| 00 04 ff fc ff fa 00 04 | 00 04 ff fc ff fc 00 00 |........|........|
|00000340| 00 00 00 00 00 00 83 00 | 0b 40 0a 62 6f 64 79 2f |........|.@.body/|
|00000350| 31 39 39 39 39 00 06 4d | 6f 6e 61 63 6f 00 3e 1a |19999..M|onaco.>.|
|00000360| 4f 53 45 72 72 20 4e 65 | 77 4c 61 79 65 72 28 4c |OSErr Ne|wLayer(L|
|00000370| 61 79 65 72 4f 62 6a 20 | 2a 6e 65 77 4c 61 79 65 |ayerObj |*newLaye|
|00000380| 72 2c 20 4c 61 79 65 72 | 4f 62 6a 20 61 62 6f 76 |r, Layer|Obj abov|
|00000390| 65 4c 61 79 65 72 2c 20 | 4c 61 79 65 72 50 72 6f |eLayer, |LayerPro|
|000003a0| 63 20 74 68 65 50 72 6f | 63 2c 20 47 72 61 66 50 |c thePro|c, GrafP|
|000003b0| 74 72 20 62 61 73 65 50 | 6f 72 74 2c 20 73 68 6f |tr baseP|ort, sho|
|000003c0| 72 74 20 64 65 70 74 68 | 2c 20 75 6e 73 69 67 6e |rt depth|, unsign|
|000003d0| 65 64 20 6c 6f 6e 67 20 | 74 68 65 44 61 74 61 29 |ed long |theData)|
|000003e0| 3b 0d 0d 20 20 20 20 46 | 69 6c 65 3a 20 47 57 4c |;.. F|ile: GWL|
|000003f0| 61 79 65 72 73 2e 68 0d | 0d 49 4e 50 55 54 3a 20 |ayers.h.|.INPUT: |
|00000400| 20 61 62 6f 76 65 4c 61 | 79 65 72 20 20 20 20 20 | aboveLa|yer |
|00000410| 20 54 68 69 73 20 69 73 | 20 74 68 65 20 6c 61 79 | This is| the lay|
|00000420| 65 72 20 61 62 6f 76 65 | 20 74 68 65 20 6c 61 79 |er above| the lay|
|00000430| 65 72 20 74 6f 20 63 72 | 65 61 74 65 2e 0d 20 20 |er to cr|eate.. |
|00000440| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000450| 20 20 20 20 20 20 49 66 | 20 74 68 65 20 6c 61 79 | If| the lay|
|00000460| 65 72 20 69 73 20 74 6f | 20 62 65 20 74 68 65 20 |er is to| be the |
|00000470| 74 6f 70 20 6c 61 79 65 | 72 2c 20 74 68 65 6e 20 |top laye|r, then |
|00000480| 70 61 73 73 20 6e 69 6c | 20 68 65 72 65 2e 0d 20 |pass nil| here.. |
|00000490| 20 20 20 20 20 20 20 74 | 68 65 50 72 6f 63 20 20 | t|heProc |
|000004a0| 20 20 20 20 20 20 20 54 | 68 65 20 70 72 6f 63 65 | T|he proce|
|000004b0| 64 75 72 65 20 70 6f 69 | 6e 74 65 72 20 66 6f 72 |dure poi|nter for|
|000004c0| 20 74 68 65 20 6c 61 79 | 65 72 20 6f 62 6a 65 63 | the lay|er objec|
|000004d0| 74 2e 20 20 49 66 20 74 | 68 65 20 64 65 66 61 75 |t. If t|he defau|
|000004e0| 6c 74 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |lt. | |
|000004f0| 20 20 20 20 20 20 20 20 | 20 20 20 61 63 74 69 6f | | actio|
|00000500| 6e 73 20 61 72 65 20 61 | 6c 6c 20 6f 6b 61 79 2c |ns are a|ll okay,|
|00000510| 20 74 68 65 6e 20 70 61 | 73 73 20 69 6e 20 6e 69 | then pa|ss in ni|
|00000520| 6c 20 68 65 72 65 2e 0d | 20 20 20 20 20 20 20 20 |l here..| |
|00000530| 62 61 73 65 50 6f 72 74 | 20 20 20 20 20 20 20 20 |basePort| |
|00000540| 49 66 20 79 6f 75 20 70 | 61 73 73 20 69 6e 20 61 |If you p|ass in a|
|00000550| 20 70 6f 72 74 20 68 65 | 72 65 2c 20 74 68 65 6e | port he|re, then|
|00000560| 20 4e 65 77 4c 61 79 65 | 72 20 77 6f 6e d5 74 20 | NewLaye|r won.t |
|00000570| 63 72 65 61 74 65 20 6f | 6e 65 0d 20 20 20 20 20 |create o|ne. |
|00000580| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000590| 20 20 20 66 6f 72 20 79 | 6f 75 2e 20 20 49 66 20 | for y|ou. If |
|000005a0| 6e 6f 20 70 6f 72 74 20 | 69 73 20 70 61 73 73 65 |no port |is passe|
|000005b0| 64 20 69 6e 2c 20 74 68 | 65 6e 20 69 74 20 77 69 |d in, th|en it wi|
|000005c0| 6c 6c 20 63 72 65 61 74 | 65 20 61 6e 0d 20 20 20 |ll creat|e an. |
|000005d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000005e0| 20 20 20 20 20 6f 66 66 | 73 63 72 65 65 6e 20 47 | off|screen G|
|000005f0| 57 6f 72 6c 64 20 28 6f | 72 20 70 6f 72 74 20 66 |World (o|r port f|
|00000600| 6f 72 20 73 79 73 74 65 | 6d 20 36 29 2c 20 62 61 |or syste|m 6), ba|
|00000610| 73 65 64 20 6f 6e 20 74 | 68 65 20 73 69 7a 65 2f |sed on t|he size/|
|00000620| 64 65 70 74 68 0d 20 20 | 20 20 20 20 20 20 20 20 |depth. | |
|00000630| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 6f 66 | | of|
|00000640| 20 74 68 65 20 6c 61 79 | 65 72 20 61 62 6f 76 65 | the lay|er above|
|00000650| 20 28 61 6e 64 20 73 6f | 6d 65 20 6f 74 68 65 72 | (and so|me other|
|00000660| 20 66 61 63 74 6f 72 73 | 29 2e 0d 20 20 20 20 20 | factors|).. |
|00000670| 20 20 20 64 65 70 74 68 | 20 20 20 20 20 20 20 20 | depth| |
|00000680| 20 20 20 54 68 65 20 64 | 65 70 74 68 20 74 6f 20 | The d|epth to |
|00000690| 63 72 65 61 74 65 20 74 | 68 65 20 6f 66 66 73 63 |create t|he offsc|
|000006a0| 72 65 65 6e 2e 20 20 49 | 66 20 30 20 69 73 20 70 |reen. I|f 0 is p|
|000006b0| 61 73 73 65 64 20 69 6e | 2c 20 74 68 65 6e 0d 20 |assed in|, then. |
|000006c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000006d0| 20 20 20 20 20 20 20 74 | 68 65 20 64 65 70 74 68 | t|he depth|
|000006e0| 20 69 73 20 62 61 73 65 | 64 20 6f 6e 20 74 68 65 | is base|d on the|
|000006f0| 20 61 62 6f 76 65 20 70 | 6f 72 74 2e 0d 20 20 20 | above p|ort.. |
|00000700| 20 20 20 20 20 74 68 65 | 44 61 74 61 20 20 20 20 | the|Data |
|00000710| 20 20 20 20 20 41 70 70 | 6c 69 63 61 74 69 6f 6e | App|lication|
|00000720| 20 72 65 66 65 72 65 6e | 63 65 20 66 69 65 6c 64 | referen|ce field|
|00000730| 2e 20 20 53 74 6f 72 65 | 20 77 68 61 74 65 76 65 |. Store| whateve|
|00000740| 72 20 79 6f 75 20 77 61 | 6e 74 20 68 65 72 65 2e |r you wa|nt here.|
|00000750| 0d 4f 55 54 50 55 54 3a | 20 6e 65 77 4c 61 79 65 |.OUTPUT:| newLaye|
|00000760| 72 20 20 20 20 20 20 20 | 20 49 66 20 73 75 63 63 |r | If succ|
|00000770| 65 73 73 66 75 6c 2c 20 | 61 20 4c 61 79 65 72 4f |essful, |a LayerO|
|00000780| 62 6a 20 68 61 6e 64 6c | 65 20 77 69 6c 6c 20 62 |bj handl|e will b|
|00000790| 65 20 72 65 74 75 72 6e | 65 64 20 68 65 72 65 2e |e return|ed here.|
|000007a0| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000007b0| 20 20 20 20 20 20 20 20 | 20 49 66 20 75 6e 73 75 | | If unsu|
|000007c0| 63 63 65 73 73 66 75 6c | 2c 20 61 20 6e 69 6c 20 |ccessful|, a nil |
|000007d0| 77 69 6c 6c 20 62 65 20 | 72 65 74 75 72 6e 65 64 |will be |returned|
|000007e0| 20 68 65 72 65 2e 0d 52 | 45 53 55 4c 54 3a 20 4f | here..R|ESULT: O|
|000007f0| 53 45 72 72 20 20 20 20 | 20 20 20 20 20 20 20 54 |SErr | T|
|00000800| 68 65 20 6d 6f 73 74 20 | 6c 69 6b 65 6c 79 20 65 |he most |likely e|
|00000810| 72 72 6f 72 20 69 73 20 | 6d 65 6d 46 75 6c 6c 45 |rror is |memFullE|
|00000820| 72 72 2e 0d 0d 47 57 4c | 61 79 65 72 73 20 69 73 |rr...GWL|ayers is|
|00000830| 20 6d 65 61 6e 74 20 74 | 6f 20 73 69 6d 70 6c 69 | meant t|o simpli|
|00000840| 66 79 20 61 6e 64 20 73 | 74 61 6e 64 61 72 64 69 |fy and s|tandardi|
|00000850| 7a 65 20 6f 66 66 73 63 | 72 65 65 6e 20 64 72 61 |ze offsc|reen dra|
|00000860| 77 69 6e 67 20 69 6e 20 | 61 20 66 6c 65 78 69 62 |wing in |a flexib|
|00000870| 6c 65 20 77 61 79 2e 0d | 0d 4e 4f 54 45 3a 20 20 |le way..|.NOTE: |
|00000880| 20 54 68 69 73 20 70 61 | 63 6b 61 67 65 20 77 61 | This pa|ckage wa|
|00000890| 73 20 6f 72 69 67 69 6e | 61 6c 6c 79 20 77 72 69 |s origin|ally wri|
|000008a0| 74 74 65 6e 20 66 6f 72 | 20 75 73 65 20 77 69 74 |tten for| use wit|
|000008b0| 68 20 47 57 6f 72 6c 64 | 73 2c 20 62 75 74 20 73 |h GWorld|s, but s|
|000008c0| 79 73 74 65 6d 20 36 0d | 20 20 20 20 20 20 20 20 |ystem 6.| |
|000008d0| 73 75 70 70 6f 72 74 20 | 68 61 73 20 62 65 65 6e |support |has been|
|000008e0| 20 61 64 64 65 64 2e 20 | 20 59 6f 75 20 6e 6f 20 | added. | You no |
|000008f0| 6c 6f 6e 67 65 72 20 6e | 65 65 64 20 73 79 73 74 |longer n|eed syst|
|00000900| 65 6d 20 37 20 6f 72 20 | 63 6f 6c 6f 72 20 71 75 |em 7 or |color qu|
|00000910| 69 63 6b 64 72 61 77 0d | 20 20 20 20 20 20 20 20 |ickdraw.| |
|00000920| 74 6f 20 75 73 65 20 74 | 68 69 73 20 70 61 63 6b |to use t|his pack|
|00000930| 61 67 65 2e 0d 0d 55 73 | 69 6e 67 20 6f 66 66 73 |age...Us|ing offs|
|00000940| 63 72 65 65 6e 20 47 57 | 6f 72 6c 64 73 20 61 6c |creen GW|orlds al|
|00000950| 6c 6f 77 73 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |lows app|lication|
|00000960| 73 20 74 6f 20 61 63 68 | 69 65 76 65 20 76 65 72 |s to ach|ieve ver|
|00000970| 79 20 63 6c 65 61 6e 20 | 67 72 61 70 68 69 63 73 |y clean |graphics|
|00000980| 0d 65 66 66 65 63 74 73 | 20 74 68 61 74 20 61 72 |.effects| that ar|
|00000990| 65 20 6e 6f 74 20 70 6f | 73 73 69 62 6c 65 20 69 |e not po|ssible i|
|000009a0| 66 20 64 72 61 77 69 6e | 67 20 64 69 72 65 63 74 |f drawin|g direct|
|000009b0| 6c 79 20 74 6f 20 61 20 | 77 69 6e 64 6f 77 20 28 |ly to a |window (|
|000009c0| 6f 72 20 67 72 61 66 50 | 6f 72 74 29 2e 0d 49 6e |or grafP|ort)..In|
|000009d0| 20 6d 6f 73 74 20 63 61 | 73 65 73 2c 20 77 68 65 | most ca|ses, whe|
|000009e0| 6e 20 61 6e 20 69 6d 61 | 67 65 20 69 73 20 67 65 |n an ima|ge is ge|
|000009f0| 6e 65 72 61 74 65 64 20 | 69 6e 20 61 6e 20 6f 66 |nerated |in an of|
|00000a00| 66 73 63 72 65 65 6e 20 | 47 57 6f 72 6c 64 2c 20 |fscreen |GWorld, |
|00000a10| 74 68 61 74 20 69 6d 61 | 67 65 0d 77 69 6c 6c 20 |that ima|ge.will |
|00000a20| 65 6e 64 20 75 70 20 62 | 65 69 6e 67 20 64 69 73 |end up b|eing dis|
|00000a30| 70 6c 61 79 65 64 20 69 | 6e 20 61 20 77 69 6e 64 |played i|n a wind|
|00000a40| 6f 77 2e 0d 0d 54 68 69 | 73 20 72 65 6c 61 74 69 |ow...Thi|s relati|
|00000a50| 6f 6e 73 68 69 70 20 62 | 65 74 77 65 65 6e 20 6f |onship b|etween o|
|00000a60| 66 66 73 63 72 65 65 6e | 20 47 57 6f 72 6c 64 73 |ffscreen| GWorlds|
|00000a70| 20 61 6e 64 20 77 69 6e | 64 6f 77 73 20 6e 65 65 | and win|dows nee|
|00000a80| 64 73 20 74 6f 20 62 65 | 20 6d 61 6e 61 67 65 64 |ds to be| managed|
|00000a90| 2e 0d 49 6e 20 61 64 64 | 69 74 69 6f 6e 20 74 6f |..In add|ition to|
|00000aa0| 20 6f 6e 65 20 47 57 6f | 72 6c 64 20 72 65 6c 61 | one GWo|rld rela|
|00000ab0| 74 69 6e 67 20 74 6f 20 | 61 20 77 69 6e 64 6f 77 |ting to |a window|
|00000ac0| 2c 20 79 6f 75 20 6d 61 | 79 20 61 63 74 75 61 6c |, you ma|y actual|
|00000ad0| 6c 79 20 6e 65 65 64 20 | 6d 75 6c 74 69 70 6c 65 |ly need |multiple|
|00000ae0| 0d 47 57 6f 72 6c 64 73 | 20 74 6f 20 72 65 6c 61 |.GWorlds| to rela|
|00000af0| 74 65 20 74 6f 20 61 20 | 77 69 6e 64 6f 77 2e 20 |te to a |window. |
|00000b00| 20 4d 61 6e 79 20 65 66 | 66 65 63 74 73 20 64 65 | Many ef|fects de|
|00000b10| 6d 61 6e 64 20 6d 6f 72 | 65 20 74 68 61 6e 20 6f |mand mor|e than o|
|00000b20| 6e 65 20 6f 66 66 73 63 | 72 65 65 6e 0d 47 57 6f |ne offsc|reen.GWo|
|00000b30| 72 6c 64 2e 20 20 53 6d | 6f 6f 74 68 6c 79 20 64 |rld. Sm|oothly d|
|00000b40| 72 61 67 67 69 6e 67 20 | 61 6e 20 69 6d 61 67 65 |ragging |an image|
|00000b50| 20 6f 76 65 72 20 61 20 | 62 61 63 6b 67 72 6f 75 | over a |backgrou|
|00000b60| 6e 64 20 69 73 20 6f 6e | 65 20 73 75 63 68 20 65 |nd is on|e such e|
|00000b70| 66 66 65 63 74 2e 0d 0d | 47 57 4c 61 79 65 72 73 |ffect...|GWLayers|
|00000b80| 2e 63 20 69 73 20 61 20 | 62 6c 6f 63 6b 20 6f 66 |.c is a |block of|
|00000b90| 20 63 6f 64 65 20 74 68 | 61 74 20 6d 61 6e 61 67 | code th|at manag|
|00000ba0| 65 73 20 74 68 65 20 6d | 6f 72 65 20 6d 75 6e 64 |es the m|ore mund|
|00000bb0| 61 6e 65 20 61 73 70 65 | 63 74 73 20 6f 66 20 68 |ane aspe|cts of h|
|00000bc0| 61 6e 64 6c 69 6e 67 20 | 6f 6e 65 0d 6f 72 20 6d |andling |one.or m|
|00000bd0| 6f 72 65 20 47 57 6f 72 | 6c 64 73 2e 20 20 47 57 |ore GWor|lds. GW|
|00000be0| 4c 61 79 65 72 73 2e 63 | 20 67 69 76 65 73 20 79 |Layers.c| gives y|
|00000bf0| 6f 75 20 61 20 63 6f 6e | 73 69 73 74 65 6e 74 20 |ou a con|sistent |
|00000c00| 77 61 79 20 6f 66 20 72 | 65 6c 61 74 69 6e 67 20 |way of r|elating |
|00000c10| 47 57 6f 72 6c 64 73 2f | 77 69 6e 64 6f 77 73 0d |GWorlds/|windows.|
|00000c20| 74 6f 67 65 74 68 65 72 | 2e 0d 0d 41 20 63 6f 6d |together|...A com|
|00000c30| 6d 6f 6e 20 75 73 65 20 | 66 6f 72 20 6f 66 66 73 |mon use |for offs|
|00000c40| 63 72 65 65 6e 20 47 57 | 6f 72 6c 64 73 20 69 73 |creen GW|orlds is|
|00000c50| 20 74 6f 20 6d 6f 76 65 | 20 61 6e 20 6f 62 6a 65 | to move| an obje|
|00000c60| 63 74 20 61 72 6f 75 6e | 64 20 69 6e 20 61 20 77 |ct aroun|d in a w|
|00000c70| 69 6e 64 6f 77 20 73 6d | 6f 6f 74 68 6c 79 0d 6f |indow sm|oothly.o|
|00000c80| 76 65 72 20 61 20 62 61 | 63 6b 67 72 6f 75 6e 64 |ver a ba|ckground|
|00000c90| 2e 20 20 54 6f 20 61 63 | 63 6f 6d 70 6c 69 73 68 |. To ac|complish|
|00000ca0| 20 74 68 69 73 2c 20 77 | 65 20 6e 65 65 64 20 33 | this, w|e need 3|
|00000cb0| 20 6c 61 79 65 72 73 2e | 0d 54 68 65 73 65 20 61 | layers.|.These a|
|00000cc0| 72 65 3a 0d 0d 31 29 20 | 20 54 68 65 20 77 69 6e |re:..1) | The win|
|00000cd0| 64 6f 77 20 6c 61 79 65 | 72 2e 20 20 54 68 69 73 |dow laye|r. This|
|00000ce0| 20 69 73 20 74 68 65 20 | 74 6f 70 2d 6d 6f 73 74 | is the |top-most|
|00000cf0| 20 6c 61 79 65 72 20 69 | 6e 20 74 68 65 20 6c 61 | layer i|n the la|
|00000d00| 79 65 72 20 68 69 65 72 | 61 72 63 68 79 2e 20 20 |yer hier|archy. |
|00000d10| 54 68 65 0d 20 20 20 20 | 74 6f 70 2d 6d 6f 73 74 |The. |top-most|
|00000d20| 20 6c 61 79 65 72 20 69 | 73 20 74 79 70 69 63 61 | layer i|s typica|
|00000d30| 6c 6c 79 20 77 68 61 74 | 20 74 68 65 20 75 73 65 |lly what| the use|
|00000d40| 72 20 77 69 6c 6c 20 73 | 65 65 2c 20 61 6e 64 20 |r will s|ee, and |
|00000d50| 74 68 65 72 65 66 6f 72 | 65 20 63 6f 6d 6d 6f 6e |therefor|e common|
|00000d60| 6c 79 0d 20 20 20 20 69 | 73 20 61 20 77 69 6e 64 |ly. i|s a wind|
|00000d70| 6f 77 20 6c 61 79 65 72 | 2e 20 20 4c 61 79 65 72 |ow layer|. Layer|
|00000d80| 73 20 62 65 6c 6f 77 20 | 74 68 65 20 74 6f 70 2d |s below |the top-|
|00000d90| 6d 6f 73 74 20 61 72 65 | 20 74 79 70 69 63 61 6c |most are| typical|
|00000da0| 6c 79 20 6f 66 66 73 63 | 72 65 65 6e 0d 20 20 20 |ly offsc|reen. |
|00000db0| 20 47 57 6f 72 6c 64 73 | 2e 0d 32 29 20 20 41 20 | GWorlds|..2) A |
|00000dc0| 6d 69 64 64 6c 65 20 6c | 61 79 65 72 20 74 68 61 |middle l|ayer tha|
|00000dd0| 74 20 69 73 20 75 73 65 | 64 20 74 6f 20 61 70 70 |t is use|d to app|
|00000de0| 6c 79 20 74 68 65 20 6f | 62 6a 65 63 74 20 62 65 |ly the o|bject be|
|00000df0| 69 6e 67 20 6d 6f 76 65 | 64 20 74 6f 20 74 68 65 |ing move|d to the|
|00000e00| 0d 20 20 20 20 62 61 63 | 6b 67 72 6f 75 6e 64 20 |. bac|kground |
|00000e10| 70 6c 75 73 20 72 65 6d | 6f 76 69 6e 67 20 74 68 |plus rem|oving th|
|00000e20| 65 20 6f 62 6a 65 63 74 | 20 66 72 6f 6d 20 74 68 |e object| from th|
|00000e30| 65 20 6f 6c 64 20 6c 6f | 63 61 74 69 6f 6e 2e 20 |e old lo|cation. |
|00000e40| 20 4f 6e 63 65 20 74 68 | 65 73 65 0d 20 20 20 20 | Once th|ese. |
|00000e50| 74 77 6f 20 74 61 73 6b | 73 20 61 72 65 20 64 6f |two task|s are do|
|00000e60| 6e 65 2c 20 74 68 65 20 | 6f 66 66 73 63 72 65 65 |ne, the |offscree|
|00000e70| 6e 20 77 6f 72 6b 20 61 | 72 65 61 20 69 73 20 72 |n work a|rea is r|
|00000e80| 65 61 64 79 20 74 6f 20 | 62 65 20 74 72 61 6e 73 |eady to |be trans|
|00000e90| 66 65 72 72 65 64 0d 20 | 20 20 20 74 6f 20 74 68 |ferred. | to th|
|00000ea0| 65 20 77 69 6e 64 6f 77 | 20 6c 61 79 65 72 2e 0d |e window| layer..|
|00000eb0| 33 29 20 20 41 20 62 61 | 63 6b 67 72 6f 75 6e 64 |3) A ba|ckground|
|00000ec0| 20 69 6d 61 67 65 20 61 | 67 61 69 6e 73 74 20 77 | image a|gainst w|
|00000ed0| 68 69 63 68 20 74 68 65 | 20 6f 62 6a 65 63 74 20 |hich the| object |
|00000ee0| 6d 6f 76 65 73 2e 20 20 | 54 68 69 73 20 69 73 20 |moves. |This is |
|00000ef0| 75 73 65 64 20 74 6f 0d | 20 20 20 20 72 65 73 74 |used to.| rest|
|00000f00| 6f 72 65 20 74 68 65 20 | 6d 69 64 64 6c 65 20 6c |ore the |middle l|
|00000f10| 61 79 65 72 20 61 74 20 | 74 68 65 20 6c 6f 63 61 |ayer at |the loca|
|00000f20| 74 69 6f 6e 20 77 68 65 | 72 65 20 74 68 65 20 6f |tion whe|re the o|
|00000f30| 62 6a 65 63 74 20 62 65 | 69 6e 67 20 6d 6f 76 65 |bject be|ing move|
|00000f40| 64 0d 20 20 20 20 77 61 | 73 20 6c 61 73 74 20 61 |d. wa|s last a|
|00000f50| 74 2e 0d 0d 54 68 65 20 | 62 61 63 6b 67 72 6f 75 |t...The |backgrou|
|00000f60| 6e 64 20 6c 61 79 65 72 | 20 69 73 20 67 65 6e 65 |nd layer| is gene|
|00000f70| 72 61 74 65 64 20 6f 6e | 6c 79 20 6f 6e 63 65 2e |rated on|ly once.|
|00000f80| 20 20 54 68 65 20 72 65 | 6c 65 76 61 6e 74 20 28 | The re|levant (|
|00000f90| 63 68 61 6e 67 69 6e 67 | 29 20 70 6f 72 74 69 6f |changing|) portio|
|00000fa0| 6e 73 20 6f 66 0d 74 68 | 65 20 62 61 63 6b 67 72 |ns of.th|e backgr|
|00000fb0| 6f 75 6e 64 20 69 6d 61 | 67 65 20 61 72 65 20 63 |ound ima|ge are c|
|00000fc0| 6f 70 69 65 64 20 69 6e | 74 6f 20 74 68 65 20 6d |opied in|to the m|
|00000fd0| 69 64 64 6c 65 20 6c 61 | 79 65 72 2e 20 20 4f 6e |iddle la|yer. On|
|00000fe0| 63 65 20 74 68 65 20 62 | 61 63 6b 67 72 6f 75 6e |ce the b|ackgroun|
|00000ff0| 64 20 70 6f 72 74 69 6f | 6e 0d 69 73 20 63 6f 70 |d portio|n.is cop|
|00001000| 69 65 64 20 69 6e 74 6f | 20 74 68 65 20 6d 69 64 |ied into| the mid|
|00001010| 64 6c 65 20 6c 61 79 65 | 72 2c 20 74 68 65 20 6f |dle laye|r, the o|
|00001020| 62 6a 65 63 74 20 74 68 | 61 74 20 69 73 20 6d 6f |bject th|at is mo|
|00001030| 76 69 6e 67 20 61 63 72 | 6f 73 73 20 74 68 65 20 |ving acr|oss the |
|00001040| 62 61 63 6b 67 72 6f 75 | 6e 64 20 69 73 0d 64 72 |backgrou|nd is.dr|
|00001050| 61 77 6e 20 69 6e 74 6f | 20 74 68 65 20 6d 69 64 |awn into| the mid|
|00001060| 64 6c 65 20 6c 61 79 65 | 72 20 6f 6e 20 74 6f 70 |dle laye|r on top|
|00001070| 20 6f 66 20 74 68 65 20 | 62 61 63 6b 67 72 6f 75 | of the |backgrou|
|00001080| 6e 64 20 70 6f 72 74 69 | 6f 6e 2e 0d 0d 4f 6e 63 |nd porti|on...Onc|
|00001090| 65 20 74 68 65 20 6d 69 | 64 64 6c 65 20 6c 61 79 |e the mi|ddle lay|
|000010a0| 65 72 20 68 61 73 20 74 | 68 65 20 62 61 63 6b 67 |er has t|he backg|
|000010b0| 72 6f 75 6e 64 20 70 6f | 72 74 69 6f 6e 20 77 69 |round po|rtion wi|
|000010c0| 74 68 20 74 68 65 20 6d | 6f 76 69 6e 67 20 6f 62 |th the m|oving ob|
|000010d0| 6a 65 63 74 20 64 72 61 | 77 6e 20 6f 6e 74 6f 20 |ject dra|wn onto |
|000010e0| 69 74 2c 0d 74 68 65 20 | 70 6f 72 74 69 6f 6e 20 |it,.the |portion |
|000010f0| 69 73 20 74 72 61 6e 73 | 66 65 72 72 65 64 20 74 |is trans|ferred t|
|00001100| 6f 20 74 68 65 20 74 6f | 70 2d 6d 6f 73 74 20 6c |o the to|p-most l|
|00001110| 61 79 65 72 2c 20 77 68 | 69 63 68 20 69 73 20 74 |ayer, wh|ich is t|
|00001120| 68 65 20 77 69 6e 64 6f | 77 20 6c 61 79 65 72 2e |he windo|w layer.|
|00001130| 20 20 54 68 65 20 75 73 | 65 72 0d 73 65 65 73 20 | The us|er.sees |
|00001140| 6f 6e 6c 79 20 74 68 69 | 73 20 66 69 6e 61 6c 20 |only thi|s final |
|00001150| 74 72 61 6e 73 66 65 72 | 2c 20 73 6f 20 74 68 65 |transfer|, so the|
|00001160| 20 69 6e 74 65 72 6d 65 | 64 69 61 74 65 20 73 74 | interme|diate st|
|00001170| 65 70 73 20 61 72 65 20 | 63 6f 6d 70 6c 65 74 65 |eps are |complete|
|00001180| 6c 79 20 68 69 64 64 65 | 6e 2e 20 20 54 68 65 0d |ly hidde|n. The.|
|00001190| 75 73 65 72 20 6a 75 73 | 74 20 73 65 65 73 20 74 |user jus|t sees t|
|000011a0| 68 65 20 6f 62 6a 65 63 | 74 20 62 65 69 6e 67 20 |he objec|t being |
|000011b0| 64 72 61 67 67 65 64 20 | 64 72 61 77 6e 20 69 6e |dragged |drawn in|
|000011c0| 74 6f 20 69 74 73 20 6e | 65 77 20 6c 6f 63 61 74 |to its n|ew locat|
|000011d0| 69 6f 6e 2e 0d 0d 54 6f | 20 6d 61 6b 65 20 74 68 |ion...To| make th|
|000011e0| 65 20 64 72 61 67 67 65 | 64 20 6f 62 6a 65 63 74 |e dragge|d object|
|000011f0| 20 73 65 65 6d 20 74 6f | 20 6d 6f 76 65 2c 20 69 | seem to| move, i|
|00001200| 74 20 69 73 20 61 6c 73 | 6f 20 69 6d 70 6f 72 74 |t is als|o import|
|00001210| 61 6e 74 20 74 6f 20 65 | 72 61 73 65 20 69 74 20 |ant to e|rase it |
|00001220| 66 72 6f 6d 20 69 74 73 | 0d 6f 6c 64 20 6c 6f 63 |from its|.old loc|
|00001230| 61 74 69 6f 6e 2e 20 20 | 49 66 20 74 68 69 73 20 |ation. |If this |
|00001240| 77 65 72 65 20 64 6f 6e | 65 20 69 6e 20 74 77 6f |were don|e in two|
|00001250| 20 73 74 65 70 73 20 28 | 72 65 73 74 6f 72 65 20 | steps (|restore |
|00001260| 6f 6c 64 20 6c 6f 63 61 | 74 69 6f 6e 2c 20 64 72 |old loca|tion, dr|
|00001270| 61 77 20 69 6e 20 6e 65 | 77 20 6c 6f 63 61 74 69 |aw in ne|w locati|
|00001280| 6f 6e 29 2c 0d 74 68 65 | 20 6d 6f 76 65 6d 65 6e |on),.the| movemen|
|00001290| 74 20 77 6f 75 6c 64 20 | 66 6c 69 63 6b 65 72 2e |t would |flicker.|
|000012a0| 20 20 54 68 65 20 75 73 | 65 72 20 77 6f 75 6c 64 | The us|er would|
|000012b0| 20 62 65 20 61 62 6c 65 | 20 74 6f 20 70 65 72 63 | be able| to perc|
|000012c0| 65 69 76 65 20 28 76 65 | 72 79 20 65 61 73 69 6c |eive (ve|ry easil|
|000012d0| 79 29 20 74 68 61 74 0d | 74 68 65 20 6f 62 6a 65 |y) that.|the obje|
|000012e0| 63 74 20 69 73 20 66 69 | 72 73 74 20 72 65 6d 6f |ct is fi|rst remo|
|000012f0| 76 65 64 20 66 72 6f 6d | 20 74 68 65 20 6f 6c 64 |ved from| the old|
|00001300| 20 6c 6f 63 61 74 69 6f | 6e 20 61 6e 64 20 74 68 | locatio|n and th|
|00001310| 65 20 72 65 64 72 61 77 | 6e 20 69 6e 20 74 68 65 |e redraw|n in the|
|00001320| 20 6e 65 77 20 6c 6f 63 | 61 74 69 6f 6e 2e 0d 54 | new loc|ation..T|
|00001330| 6f 20 70 72 65 76 65 6e | 74 20 74 68 69 73 20 66 |o preven|t this f|
|00001340| 6c 69 63 6b 65 72 69 6e | 67 2c 20 74 68 65 20 6f |lickerin|g, the o|
|00001350| 6c 64 20 6c 6f 63 61 74 | 69 6f 6e 20 61 6e 64 20 |ld locat|ion and |
|00001360| 74 68 65 20 6e 65 77 20 | 6c 6f 63 61 74 69 6f 6e |the new |location|
|00001370| 20 68 61 76 65 20 74 6f | 20 62 65 20 75 70 64 61 | have to| be upda|
|00001380| 74 65 64 0d 69 6e 20 61 | 20 73 69 6e 67 6c 65 20 |ted.in a| single |
|00001390| 73 74 65 70 2e 20 20 57 | 6f 72 6b 69 6e 67 20 6f |step. W|orking o|
|000013a0| 66 66 73 63 72 65 65 6e | 20 61 6c 6c 6f 77 73 20 |ffscreen| allows |
|000013b0| 74 68 69 73 2e 20 20 54 | 68 65 20 6d 69 64 64 6c |this. T|he middl|
|000013c0| 65 20 6c 61 79 65 72 20 | 69 73 20 66 69 72 73 74 |e layer |is first|
|000013d0| 20 75 70 64 61 74 65 64 | 20 73 6f 0d 74 68 61 74 | updated| so.that|
|000013e0| 20 74 68 65 20 6f 6c 64 | 20 6c 6f 63 61 74 69 6f | the old| locatio|
|000013f0| 6e 20 6f 66 20 74 68 65 | 20 6f 62 6a 65 63 74 20 |n of the| object |
|00001400| 69 73 20 72 65 73 74 6f | 72 65 64 20 74 6f 20 62 |is resto|red to b|
|00001410| 61 63 6b 67 72 6f 75 6e | 64 2e 20 20 54 68 65 20 |ackgroun|d. The |
|00001420| 6d 69 64 64 6c 65 20 6c | 61 79 65 72 20 74 68 65 |middle l|ayer the|
|00001430| 6e 20 68 61 73 0d 74 68 | 65 20 6f 62 6a 65 63 74 |n has.th|e object|
|00001440| 20 64 72 61 77 6e 20 69 | 6e 74 6f 20 74 68 65 20 | drawn i|nto the |
|00001450| 6e 65 77 20 6c 6f 63 61 | 74 69 6f 6e 2e 20 20 41 |new loca|tion. A|
|00001460| 6e 64 20 74 68 65 6e 20 | 77 68 65 6e 20 74 68 65 |nd then |when the|
|00001470| 20 74 72 61 6e 73 66 65 | 72 20 66 69 6e 61 6c 6c | transfe|r finall|
|00001480| 79 20 6f 63 63 75 72 73 | 20 69 6e 74 6f 0d 74 68 |y occurs| into.th|
|00001490| 65 20 77 69 6e 64 6f 77 | 20 6c 61 79 65 72 2c 20 |e window| layer, |
|000014a0| 61 6e 20 61 72 65 61 20 | 6c 61 72 67 65 20 65 6e |an area |large en|
|000014b0| 6f 75 67 68 20 74 6f 20 | 63 6f 76 65 72 20 62 6f |ough to |cover bo|
|000014c0| 74 68 20 74 68 65 20 6f | 6c 64 20 6c 6f 63 61 74 |th the o|ld locat|
|000014d0| 69 6f 6e 20 61 6e 64 20 | 74 68 65 20 6e 65 77 20 |ion and |the new |
|000014e0| 6c 6f 63 61 74 69 6f 6e | 0d 61 72 65 20 74 72 61 |location|.are tra|
|000014f0| 6e 73 66 65 72 72 65 64 | 20 61 74 20 6f 6e 63 65 |nsferred| at once|
|00001500| 20 77 69 74 68 20 61 20 | 73 69 6e 67 6c 65 20 43 | with a |single C|
|00001510| 6f 70 79 42 69 74 73 2e | 0d 0d 0d 47 57 4c 61 79 |opyBits.|...GWLay|
|00001520| 65 72 73 2e 63 20 63 6f | 6e 76 65 6e 74 69 6f 6e |ers.c co|nvention|
|00001530| 73 3a 0d 0d 55 70 64 61 | 74 69 6e 67 20 6f 66 20 |s:..Upda|ting of |
|00001540| 65 61 63 68 20 6c 61 79 | 65 72 20 69 73 20 68 61 |each lay|er is ha|
|00001550| 6e 64 6c 65 64 20 62 79 | 20 74 68 65 20 6c 61 79 |ndled by| the lay|
|00001560| 65 72 20 69 74 73 65 6c | 66 2e 20 20 41 20 70 61 |er itsel|f. A pa|
|00001570| 72 74 69 63 75 6c 61 72 | 20 6c 61 79 65 72 20 63 |rticular| layer c|
|00001580| 68 65 63 6b 73 20 74 6f | 0d 73 65 65 20 69 66 20 |hecks to|.see if |
|00001590| 74 68 65 72 65 20 69 73 | 20 61 20 6c 61 79 65 72 |there is| a layer|
|000015a0| 20 62 65 6c 6f 77 2c 20 | 61 6e 64 20 69 66 20 74 | below, |and if t|
|000015b0| 68 65 72 65 20 69 73 2c | 20 64 6f 65 73 20 61 20 |here is,| does a |
|000015c0| 43 6f 70 79 42 69 74 73 | 20 6f 66 20 74 68 65 20 |CopyBits| of the |
|000015d0| 72 65 6c 65 76 61 6e 74 | 20 61 72 65 61 0d 66 72 |relevant| area.fr|
|000015e0| 6f 6d 20 74 68 65 20 62 | 65 6c 6f 77 20 6c 61 79 |om the b|elow lay|
|000015f0| 65 72 20 69 6e 74 6f 20 | 69 74 73 65 6c 66 2e 20 |er into |itself. |
|00001600| 20 49 66 20 61 66 74 65 | 72 20 74 68 65 20 43 6f | If afte|r the Co|
|00001610| 70 79 42 69 74 73 20 74 | 68 65 72 65 20 69 73 20 |pyBits t|here is |
|00001620| 61 6e 79 20 61 64 64 69 | 74 69 6f 6e 61 6c 0d 64 |any addi|tional.d|
|00001630| 72 61 77 69 6e 67 20 6e | 65 65 64 65 64 20 28 73 |rawing n|eeded (s|
|00001640| 75 63 68 20 61 73 20 74 | 68 65 20 6d 69 64 64 6c |uch as t|he middl|
|00001650| 65 20 6c 61 79 65 72 20 | 69 6e 20 74 68 65 20 61 |e layer |in the a|
|00001660| 62 6f 76 65 20 65 78 61 | 6d 70 6c 65 29 2c 20 74 |bove exa|mple), t|
|00001670| 68 65 6e 20 69 74 20 69 | 73 20 74 79 70 69 63 61 |hen it i|s typica|
|00001680| 6c 6c 79 0d 64 6f 6e 65 | 20 61 66 74 65 72 20 74 |lly.done| after t|
|00001690| 68 65 20 43 6f 70 79 42 | 69 74 73 2e 0d 0d 53 69 |he CopyB|its...Si|
|000016a0| 6e 63 65 20 74 68 65 20 | 6c 61 79 65 72 73 20 61 |nce the |layers a|
|000016b0| 63 74 75 61 6c 6c 79 20 | 6e 65 65 64 20 74 6f 20 |ctually |need to |
|000016c0| 75 70 64 61 74 65 20 66 | 72 6f 6d 20 74 68 65 20 |update f|rom the |
|000016d0| 62 6f 74 74 6f 6d 2d 6d | 6f 73 74 20 6c 61 79 65 |bottom-m|ost laye|
|000016e0| 72 20 74 6f 20 74 68 65 | 20 74 6f 70 2d 6d 6f 73 |r to the| top-mos|
|000016f0| 74 0d 6c 61 79 65 72 20 | 28 74 6f 70 2d 6d 6f 73 |t.layer |(top-mos|
|00001700| 74 20 62 65 69 6e 67 20 | 74 68 65 20 77 69 6e 64 |t being |the wind|
|00001710| 6f 77 2c 20 73 68 6f 77 | 69 6e 67 20 74 68 65 20 |ow, show|ing the |
|00001720| 66 69 6e 61 6c 20 72 65 | 73 75 6c 74 29 2c 20 74 |final re|sult), t|
|00001730| 68 65 20 6c 61 79 65 72 | 20 75 70 64 61 74 69 6e |he layer| updatin|
|00001740| 67 20 63 6f 64 65 0d 63 | 68 65 63 6b 73 20 74 6f |g code.c|hecks to|
|00001750| 20 73 65 65 20 69 66 20 | 74 68 65 72 65 20 69 73 | see if |there is|
|00001760| 20 61 20 6c 61 79 65 72 | 20 62 65 6c 6f 77 2e 20 | a layer| below. |
|00001770| 20 49 66 20 74 68 65 72 | 65 20 69 73 2c 20 74 68 | If ther|e is, th|
|00001780| 65 6e 20 74 68 65 20 75 | 70 64 61 74 65 20 70 72 |en the u|pdate pr|
|00001790| 6f 63 65 64 75 72 65 20 | 69 73 0d 63 61 6c 6c 65 |ocedure |is.calle|
|000017a0| 64 20 66 6f 72 20 74 68 | 65 20 6c 61 79 65 72 20 |d for th|e layer |
|000017b0| 62 65 6c 6f 77 2e 20 20 | 54 68 69 73 20 72 65 63 |below. |This rec|
|000017c0| 75 72 73 69 6f 6e 20 63 | 6f 6e 74 69 6e 75 65 73 |ursion c|ontinues|
|000017d0| 20 75 6e 74 69 6c 20 74 | 68 65 20 62 6f 74 74 6f | until t|he botto|
|000017e0| 6d 2d 6d 6f 73 74 20 6c | 61 79 65 72 20 69 73 0d |m-most l|ayer is.|
|000017f0| 72 65 61 63 68 65 64 2e | 20 20 54 68 65 20 62 6f |reached.| The bo|
|00001800| 74 74 6f 6d 2d 6d 6f 73 | 74 20 6c 61 79 65 72 20 |ttom-mos|t layer |
|00001810| 74 68 65 6e 20 64 6f 65 | 73 20 69 74 73 20 74 68 |then doe|s its th|
|00001820| 69 6e 67 2e 20 20 28 46 | 6f 72 20 74 68 65 20 63 |ing. (F|or the c|
|00001830| 61 73 65 20 77 68 65 72 | 65 20 74 68 65 20 62 6f |ase wher|e the bo|
|00001840| 74 74 6f 6d 2d 6d 6f 73 | 74 0d 6c 61 79 65 72 20 |ttom-mos|t.layer |
|00001850| 69 73 20 62 61 63 6b 67 | 72 6f 75 6e 64 20 74 68 |is backg|round th|
|00001860| 69 73 20 22 74 68 69 6e | 67 22 20 77 69 6c 6c 20 |is "thin|g" will |
|00001870| 62 65 20 74 6f 20 64 6f | 20 6e 6f 74 68 69 6e 67 |be to do| nothing|
|00001880| 2e 29 20 20 4f 6e 63 65 | 20 74 68 65 20 75 70 64 |.) Once| the upd|
|00001890| 61 74 65 20 66 6f 72 20 | 74 68 65 20 6c 61 79 65 |ate for |the laye|
|000018a0| 72 0d 69 73 20 63 6f 6d | 70 6c 65 74 65 64 2c 20 |r.is com|pleted, |
|000018b0| 74 68 65 20 75 70 64 61 | 74 65 20 70 72 6f 63 65 |the upda|te proce|
|000018c0| 64 75 72 65 20 73 69 6d | 70 6c 79 20 72 65 74 75 |dure sim|ply retu|
|000018d0| 72 6e 73 2e 20 20 49 74 | 20 77 69 6c 6c 20 72 65 |rns. It| will re|
|000018e0| 74 75 72 6e 20 74 6f 20 | 74 68 65 20 63 61 6c 6c |turn to |the call|
|000018f0| 65 72 2c 20 77 68 69 63 | 68 0d 69 73 20 74 68 65 |er, whic|h.is the|
|00001900| 20 6c 61 79 65 72 20 61 | 62 6f 76 65 20 69 74 20 | layer a|bove it |
|00001910| 28 69 66 20 61 6e 79 29 | 2e 20 20 54 68 65 20 6e |(if any)|. The n|
|00001920| 65 78 74 20 6c 61 79 65 | 72 20 75 70 20 64 6f 65 |ext laye|r up doe|
|00001930| 73 20 69 74 73 20 74 68 | 69 6e 67 2c 20 61 6e 64 |s its th|ing, and|
|00001940| 20 74 68 65 6e 20 72 65 | 74 75 72 6e 73 2c 20 61 | then re|turns, a|
|00001950| 6e 64 0d 73 6f 20 6f 6e | 2e 20 20 54 68 69 73 20 |nd.so on|. This |
|00001960| 72 65 63 75 72 73 69 76 | 65 20 63 68 61 69 6e 20 |recursiv|e chain |
|00001970| 6f 66 20 6c 61 79 65 72 | 73 20 61 6c 6c 6f 77 73 |of layer|s allows|
|00001980| 20 74 68 65 20 75 70 64 | 61 74 69 6e 67 20 74 6f | the upd|ating to|
|00001990| 20 68 61 70 70 65 6e 20 | 61 75 74 6f 6d 61 74 69 | happen |automati|
|000019a0| 63 61 6c 6c 79 20 69 6e | 0d 74 68 65 20 6f 72 64 |cally in|.the ord|
|000019b0| 65 72 20 64 65 73 69 67 | 6e 61 74 65 64 20 62 79 |er desig|nated by|
|000019c0| 20 74 68 65 20 6c 61 79 | 65 72 20 68 69 65 72 61 | the lay|er hiera|
|000019d0| 72 63 68 79 2e 0d 0d 53 | 69 6e 63 65 20 77 69 6e |rchy...S|ince win|
|000019e0| 64 6f 77 20 72 65 63 6f | 72 64 73 20 61 6e 64 20 |dow reco|rds and |
|000019f0| 47 57 6f 72 6c 64 20 72 | 65 63 6f 72 64 73 20 64 |GWorld r|ecords d|
|00001a00| 6f 6e 27 74 20 68 61 76 | 65 20 61 6e 79 20 66 69 |on't hav|e any fi|
|00001a10| 65 6c 64 73 20 66 6f 72 | 20 61 6c 6c 20 6f 66 20 |elds for| all of |
|00001a20| 74 68 65 20 73 74 75 66 | 66 20 77 65 0d 6e 65 65 |the stuf|f we.nee|
|00001a30| 64 20 74 6f 20 6b 65 65 | 70 20 28 73 75 63 68 20 |d to kee|p (such |
|00001a40| 61 73 20 61 62 6f 76 65 | 2d 6c 61 79 65 72 2c 20 |as above|-layer, |
|00001a50| 62 65 6c 6f 77 2d 6c 61 | 79 65 72 2c 20 75 70 64 |below-la|yer, upd|
|00001a60| 61 74 65 20 70 72 6f 63 | 65 64 75 72 65 73 2c 20 |ate proc|edures, |
|00001a70| 65 74 63 2e 29 2c 20 74 | 68 69 73 0d 69 6d 70 6c |etc.), t|his.impl|
|00001a80| 65 6d 65 6e 74 61 74 69 | 6f 6e 20 75 73 65 73 20 |ementati|on uses |
|00001a90| 61 20 68 61 6e 64 6c 65 | 20 74 6f 20 68 6f 6c 64 |a handle| to hold|
|00001aa0| 20 74 68 65 20 6c 61 79 | 65 72 20 72 65 63 6f 72 | the lay|er recor|
|00001ab0| 64 2e 20 20 45 61 63 68 | 20 6c 61 79 65 72 20 72 |d. Each| layer r|
|00001ac0| 65 63 6f 72 64 20 68 61 | 73 20 61 20 72 65 66 65 |ecord ha|s a refe|
|00001ad0| 72 65 6e 63 65 0d 74 6f | 20 74 68 65 20 77 69 6e |rence.to| the win|
|00001ae0| 64 6f 77 20 6f 72 20 47 | 57 6f 72 6c 64 20 69 73 |dow or G|World is|
|00001af0| 20 69 73 20 74 6f 20 64 | 72 61 77 20 69 6e 74 6f | is to d|raw into|
|00001b00| 2c 20 70 6c 75 73 20 61 | 20 72 65 66 65 72 65 6e |, plus a| referen|
|00001b10| 63 65 20 74 6f 20 77 68 | 61 74 20 6c 61 79 65 72 |ce to wh|at layer|
|00001b20| 73 20 72 65 63 6f 72 64 | 73 0d 61 72 65 20 61 62 |s record|s.are ab|
|00001b30| 6f 76 65 20 61 6e 64 20 | 62 65 6c 6f 77 2c 20 69 |ove and |below, i|
|00001b40| 66 20 61 6e 79 2e 20 20 | 54 68 65 20 73 74 72 75 |f any. |The stru|
|00001b50| 63 74 75 72 65 20 66 6f | 72 20 61 20 6c 61 79 65 |cture fo|r a laye|
|00001b60| 72 20 72 65 63 6f 72 64 | 20 69 73 20 61 73 20 66 |r record| is as f|
|00001b70| 6f 6c 6c 6f 77 73 3a 0d | 0d 74 79 70 65 64 65 66 |ollows:.|.typedef|
|00001b80| 20 73 74 72 75 63 74 20 | 4c 61 79 65 72 52 65 63 | struct |LayerRec|
|00001b90| 20 7b 0d 20 20 20 20 4c | 61 79 65 72 4f 62 6a 20 | {. L|ayerObj |
|00001ba0| 20 20 20 20 20 20 20 61 | 62 6f 76 65 4c 61 79 65 | a|boveLaye|
|00001bb0| 72 3b 20 20 20 20 20 20 | 20 20 20 4e 69 6c 20 69 |r; | Nil i|
|00001bc0| 66 20 6e 6f 20 61 62 6f | 76 65 20 6c 61 79 65 72 |f no abo|ve layer|
|00001bd0| 2e 0d 20 20 20 20 4c 61 | 79 65 72 4f 62 6a 20 20 |.. La|yerObj |
|00001be0| 20 20 20 20 20 20 62 65 | 6c 6f 77 4c 61 79 65 72 | be|lowLayer|
|00001bf0| 3b 20 20 20 20 20 20 20 | 20 20 4e 69 6c 20 69 66 |; | Nil if|
|00001c00| 20 6e 6f 20 62 65 6c 6f | 77 20 6c 61 79 65 72 2e | no belo|w layer.|
|00001c10| 0d 20 20 20 20 42 6f 6f | 6c 65 61 6e 20 20 20 20 |. Boo|lean |
|00001c20| 20 20 20 20 20 6c 61 79 | 65 72 4f 77 6e 73 50 6f | lay|erOwnsPo|
|00001c30| 72 74 3b 20 20 20 20 20 | 20 54 72 75 65 20 69 66 |rt; | True if|
|00001c40| 20 6c 61 79 65 72 20 63 | 72 65 61 74 65 64 20 74 | layer c|reated t|
|00001c50| 68 65 20 47 57 6f 72 6c | 64 2e 0d 20 20 20 20 47 |he GWorl|d.. G|
|00001c60| 72 61 66 50 74 72 20 20 | 20 20 20 20 20 20 20 6c |rafPtr | l|
|00001c70| 61 79 65 72 50 6f 72 74 | 3b 20 20 20 20 20 20 20 |ayerPort|; |
|00001c80| 20 20 20 57 69 6e 64 6f | 77 20 6f 72 20 47 57 6f | Windo|w or GWo|
|00001c90| 72 6c 64 20 74 68 69 73 | 20 6c 61 79 65 72 20 64 |rld this| layer d|
|00001ca0| 72 61 77 73 20 69 6e 74 | 6f 2e 0d 20 20 20 20 47 |raws int|o.. G|
|00001cb0| 44 48 61 6e 64 6c 65 20 | 20 20 20 20 20 20 20 6c |DHandle | l|
|00001cc0| 61 79 65 72 47 44 65 76 | 69 63 65 3b 20 20 20 20 |ayerGDev|ice; |
|00001cd0| 20 20 20 54 68 65 20 47 | 44 65 76 69 63 65 20 66 | The G|Device f|
|00001ce0| 6f 72 20 74 68 69 73 20 | 6c 61 79 65 72 2e 0d 20 |or this |layer.. |
|00001cf0| 20 20 20 48 61 6e 64 6c | 65 20 20 20 20 20 20 20 | Handl|e |
|00001d00| 20 20 20 6c 61 79 65 72 | 42 69 74 6d 61 70 3b 20 | layer|Bitmap; |
|00001d10| 20 20 20 20 20 20 20 49 | 66 20 47 57 6f 72 6c 64 | I|f GWorld|
|00001d20| 73 20 61 72 65 6e 27 74 | 20 61 76 61 69 6c 61 62 |s aren't| availab|
|00001d30| 6c 65 2c 20 74 68 69 73 | 20 68 6f 6c 64 73 20 74 |le, this| holds t|
|00001d40| 68 65 20 62 69 74 6d 61 | 70 2e 0d 20 20 20 20 73 |he bitma|p.. s|
|00001d50| 68 6f 72 74 20 20 20 20 | 20 20 20 20 20 20 20 6c |hort | l|
|00001d60| 61 79 65 72 44 65 70 74 | 68 3b 20 20 20 20 20 20 |ayerDept|h; |
|00001d70| 20 20 20 52 65 71 75 65 | 73 74 65 64 20 4e 65 77 | Reque|sted New|
|00001d80| 4c 61 79 65 72 20 64 65 | 70 74 68 20 6f 66 20 70 |Layer de|pth of p|
|00001d90| 69 78 6d 61 70 2e 0d 20 | 20 20 20 4c 61 79 65 72 |ixmap.. | Layer|
|00001da0| 50 72 6f 63 20 20 20 20 | 20 20 20 6c 61 79 65 72 |Proc | layer|
|00001db0| 50 72 6f 63 3b 20 20 20 | 20 20 20 20 20 20 20 4c |Proc; | L|
|00001dc0| 61 79 65 72 20 70 72 6f | 63 65 64 75 72 65 2e 20 |ayer pro|cedure. |
|00001dd0| 20 49 66 20 6e 69 6c 2c | 20 74 68 65 6e 20 64 65 | If nil,| then de|
|00001de0| 66 61 75 6c 74 20 62 65 | 68 61 76 69 6f 72 73 20 |fault be|haviors |
|00001df0| 75 73 65 64 2e 0d 20 20 | 20 20 75 6e 73 69 67 6e |used.. | unsign|
|00001e00| 65 64 20 6c 6f 6e 67 20 | 20 20 6c 61 79 65 72 44 |ed long | layerD|
|00001e10| 61 74 61 3b 20 20 20 20 | 20 20 20 20 20 20 41 70 |ata; | Ap|
|00001e20| 70 6c 69 63 61 74 69 6f | 6e 20 72 65 66 43 6f 6e |plicatio|n refCon|
|00001e30| 2d 74 79 70 65 20 66 69 | 65 6c 64 2e 0d 20 20 20 |-type fi|eld.. |
|00001e40| 20 73 68 6f 72 74 20 20 | 20 20 20 20 20 20 20 20 | short | |
|00001e50| 20 78 66 65 72 4d 6f 64 | 65 3b 20 20 20 20 20 20 | xferMod|e; |
|00001e60| 20 20 20 20 20 54 72 61 | 6e 73 66 65 72 20 6d 6f | Tra|nsfer mo|
|00001e70| 64 65 20 66 6f 72 20 43 | 6f 70 79 42 69 74 73 2e |de for C|opyBits.|
|00001e80| 0d 20 20 20 20 52 65 63 | 74 20 20 20 20 20 20 20 |. Rec|t |
|00001e90| 20 20 20 20 20 73 72 63 | 52 65 63 74 3b 20 20 20 | src|Rect; |
|00001ea0| 20 20 20 20 20 20 20 20 | 20 49 6e 69 74 69 61 6c | | Initial|
|00001eb0| 6c 79 20 6e 69 6c 2c 20 | 77 68 69 63 68 20 6d 61 |ly nil, |which ma|
|00001ec0| 6b 65 73 20 65 6e 74 69 | 72 65 20 47 57 6f 72 6c |kes enti|re GWorl|
|00001ed0| 64 20 73 6f 75 72 63 65 | 2e 0d 20 20 20 20 52 65 |d source|.. Re|
|00001ee0| 63 74 20 20 20 20 20 20 | 20 20 20 20 20 20 64 73 |ct | ds|
|00001ef0| 74 52 65 63 74 3b 20 20 | 20 20 20 20 20 20 20 20 |tRect; | |
|00001f00| 20 20 49 6e 69 74 69 61 | 6c 6c 79 20 6e 69 6c 2c | Initia|lly nil,|
|00001f10| 20 77 68 69 63 68 20 6d | 61 6b 65 73 20 65 6e 74 | which m|akes ent|
|00001f20| 69 72 65 20 77 69 6e 64 | 6f 77 2f 47 57 6f 72 6c |ire wind|ow/GWorl|
|00001f30| 64 20 64 65 73 74 2e 0d | 20 20 20 20 52 65 63 74 |d dest..| Rect|
|00001f40| 20 20 20 20 20 20 20 20 | 20 20 20 20 74 68 69 73 | | this|
|00001f50| 55 70 64 61 74 65 3b 20 | 20 20 20 20 20 20 20 20 |Update; | |
|00001f60| 41 72 65 61 20 74 6f 20 | 62 65 20 75 70 64 61 74 |Area to |be updat|
|00001f70| 65 64 20 66 6f 72 20 74 | 68 69 73 20 75 70 64 61 |ed for t|his upda|
|00001f80| 74 65 2e 0d 20 20 20 20 | 52 65 63 74 20 20 20 20 |te.. |Rect |
|00001f90| 20 20 20 20 20 20 20 20 | 6c 61 73 74 55 70 64 61 | |lastUpda|
|00001fa0| 74 65 3b 20 20 20 20 20 | 20 20 20 20 41 72 65 61 |te; | Area|
|00001fb0| 20 75 70 64 61 74 65 64 | 20 6c 61 73 74 20 74 69 | updated| last ti|
|00001fc0| 6d 65 20 55 70 64 61 74 | 65 4c 61 79 65 72 20 77 |me Updat|eLayer w|
|00001fd0| 61 73 20 63 61 6c 6c 65 | 64 2e 0d 20 20 20 20 42 |as calle|d.. B|
|00001fe0| 6f 6f 6c 65 61 6e 20 20 | 20 20 20 20 20 20 20 69 |oolean | i|
|00001ff0| 6e 63 6c 75 64 65 4c 61 | 73 74 55 70 64 61 74 65 |ncludeLa|stUpdate|
|00002000| 3b 20 20 54 72 75 65 20 | 69 73 20 6c 61 73 74 20 |; True |is last |
|00002010| 75 70 64 61 74 65 64 20 | 61 72 65 61 20 69 73 20 |updated |area is |
|00002020| 6f 20 75 70 64 61 74 65 | 64 20 61 73 20 77 65 6c |o update|d as wel|
|00002030| 6c 2e 0d 20 20 20 20 42 | 6f 6f 6c 65 61 6e 20 20 |l.. B|oolean |
|00002040| 20 20 20 20 20 20 20 6c | 6f 63 6b 65 64 43 6f 75 | l|ockedCou|
|00002050| 6e 74 3b 20 20 20 20 20 | 20 20 20 55 73 65 64 20 |nt; | Used |
|00002060| 69 6e 74 65 72 6e 61 6c | 6c 79 20 62 79 20 47 57 |internal|ly by GW|
|00002070| 6f 72 6c 64 20 6c 6f 63 | 6b 69 6e 67 2f 75 6e 6c |orld loc|king/unl|
|00002080| 6f 63 6b 69 6e 67 20 63 | 61 6c 6c 73 2e 0d 20 20 |ocking c|alls.. |
|00002090| 20 20 42 6f 6f 6c 65 61 | 6e 20 20 20 20 20 20 20 | Boolea|n |
|000020a0| 20 20 63 61 63 68 65 64 | 43 6f 75 6e 74 3b 20 20 | cached|Count; |
|000020b0| 20 20 20 20 20 20 55 73 | 65 64 20 69 6e 74 65 72 | Us|ed inter|
|000020c0| 6e 61 6c 6c 79 20 62 79 | 20 47 57 6f 72 6c 64 20 |nally by| GWorld |
|000020d0| 6c 6f 63 6b 69 6e 67 2f | 75 6e 6c 6f 63 6b 69 6e |locking/|unlockin|
|000020e0| 67 20 63 61 6c 6c 73 2e | 0d 20 20 20 20 43 47 72 |g calls.|. CGr|
|000020f0| 61 66 50 74 72 20 20 20 | 20 20 20 20 20 63 61 63 |afPtr | cac|
|00002100| 68 65 64 50 6f 72 74 3b | 20 20 20 20 20 20 20 20 |hedPort;| |
|00002110| 20 55 73 65 64 20 69 6e | 74 65 72 6e 61 6c 6c 79 | Used in|ternally|
|00002120| 20 62 79 20 47 57 6f 72 | 6c 64 20 75 73 61 67 65 | by GWor|ld usage|
|00002130| 20 63 61 6c 6c 73 2e 0d | 20 20 20 20 47 44 48 61 | calls..| GDHa|
|00002140| 6e 64 6c 65 20 20 20 20 | 20 20 20 20 63 61 63 68 |ndle | cach|
|00002150| 65 64 47 44 65 76 69 63 | 65 3b 20 20 20 20 20 20 |edGDevic|e; |
|00002160| 55 73 65 64 20 69 6e 74 | 65 72 6e 61 6c 6c 79 20 |Used int|ernally |
|00002170| 62 79 20 47 57 6f 72 6c | 64 20 75 73 61 67 65 20 |by GWorl|d usage |
|00002180| 63 61 6c 6c 73 2e 0d 7d | 20 4c 61 79 65 72 52 65 |calls..}| LayerRe|
|00002190| 63 3b 0d 0d 6c 61 79 65 | 72 4f 77 6e 73 50 6f 72 |c;..laye|rOwnsPor|
|000021a0| 74 3a 0d 20 20 20 20 49 | 66 20 74 68 65 20 6c 61 |t:. I|f the la|
|000021b0| 79 65 72 20 63 72 65 61 | 74 65 64 20 74 68 65 20 |yer crea|ted the |
|000021c0| 47 57 6f 72 6c 64 2c 20 | 74 68 65 6e 20 69 74 20 |GWorld, |then it |
|000021d0| 69 73 20 74 68 65 20 6c | 61 79 65 72 27 73 20 72 |is the l|ayer's r|
|000021e0| 65 73 70 6f 6e 73 69 62 | 69 6c 69 74 79 20 74 6f |esponsib|ility to|
|000021f0| 20 67 65 74 20 72 69 64 | 0d 20 20 20 20 6f 66 20 | get rid|. of |
|00002200| 69 74 73 20 47 57 6f 72 | 6c 64 20 77 68 65 6e 20 |its GWor|ld when |
|00002210| 74 68 65 20 6c 61 79 65 | 72 20 69 73 20 64 69 73 |the laye|r is dis|
|00002220| 70 6f 73 65 64 20 6f 66 | 2e 20 20 49 66 20 74 68 |posed of|. If th|
|00002230| 69 73 20 66 6c 61 67 20 | 69 73 20 74 72 75 65 2c |is flag |is true,|
|00002240| 20 74 68 65 20 47 57 6f | 72 6c 64 0d 20 20 20 20 | the GWo|rld. |
|00002250| 77 69 6c 6c 20 62 65 20 | 64 69 73 70 6f 73 65 64 |will be |disposed|
|00002260| 20 6f 66 20 77 68 65 6e | 20 74 68 65 20 6c 61 79 | of when| the lay|
|00002270| 65 72 20 69 73 20 64 69 | 73 70 6f 73 65 64 20 6f |er is di|sposed o|
|00002280| 66 2e 0d 0d 6c 61 79 65 | 72 50 72 6f 63 3a 0d 20 |f...laye|rProc:. |
|00002290| 20 20 20 54 68 69 73 20 | 69 73 20 6e 69 6c 20 69 | This |is nil i|
|000022a0| 66 20 74 68 65 20 64 65 | 66 61 75 6c 74 20 62 65 |f the de|fault be|
|000022b0| 68 61 76 69 6f 72 73 20 | 61 72 65 20 61 63 63 65 |haviors |are acce|
|000022c0| 70 74 61 62 6c 65 20 66 | 6f 72 20 61 20 70 61 72 |ptable f|or a par|
|000022d0| 74 69 63 75 6c 61 72 20 | 6c 61 79 65 72 2e 0d 20 |ticular |layer.. |
|000022e0| 20 20 20 49 66 20 74 68 | 69 73 20 69 73 20 6e 6f | If th|is is no|
|000022f0| 6e 2d 6e 69 6c 2c 20 74 | 68 65 6e 20 79 6f 75 20 |n-nil, t|hen you |
|00002300| 61 72 65 20 72 65 73 70 | 6f 6e 73 69 62 6c 65 20 |are resp|onsible |
|00002310| 66 6f 72 20 69 6d 70 6c | 65 6d 65 6e 74 69 6e 67 |for impl|ementing|
|00002320| 20 65 61 63 68 20 6c 61 | 79 65 72 0d 20 20 20 20 | each la|yer. |
|00002330| 6d 65 73 73 61 67 65 20 | 62 65 68 61 76 69 6f 72 |message |behavior|
|00002340| 2e 20 20 28 4d 6f 72 65 | 20 6f 6e 20 74 68 69 73 |. (More| on this|
|00002350| 20 6c 61 74 65 72 2e 29 | 0d 0d 78 66 65 72 4d 6f | later.)|..xferMo|
|00002360| 64 65 3a 0d 20 20 20 20 | 54 68 69 73 20 69 73 20 |de:. |This is |
|00002370| 74 68 65 20 74 72 61 6e | 73 66 65 72 20 6d 6f 64 |the tran|sfer mod|
|00002380| 65 20 66 6f 72 20 43 6f | 70 79 42 69 74 73 2e 20 |e for Co|pyBits. |
|00002390| 20 54 68 65 20 64 65 66 | 61 75 6c 74 20 62 65 68 | The def|ault beh|
|000023a0| 61 76 69 6f 72 20 66 6f | 72 20 75 70 64 61 74 69 |avior fo|r updati|
|000023b0| 6e 67 20 73 69 6d 70 6c | 79 0d 20 20 20 20 74 72 |ng simpl|y. tr|
|000023c0| 61 6e 73 66 65 72 73 20 | 73 6f 6d 65 20 6f 72 20 |ansfers |some or |
|000023d0| 61 6c 6c 20 6f 66 20 74 | 68 65 20 62 65 6c 6f 77 |all of t|he below|
|000023e0| 20 6c 61 79 65 72 20 28 | 69 66 20 74 68 65 72 65 | layer (|if there|
|000023f0| 20 69 73 20 6f 6e 65 29 | 20 69 6e 74 6f 20 74 68 | is one)| into th|
|00002400| 65 20 63 75 72 72 65 6e | 74 20 6c 61 79 65 72 2e |e curren|t layer.|
|00002410| 0d 20 20 20 20 49 74 20 | 64 6f 65 73 20 74 68 69 |. It |does thi|
|00002420| 73 20 77 69 74 68 20 43 | 6f 70 79 42 69 74 73 2c |s with C|opyBits,|
|00002430| 20 75 73 69 6e 67 20 74 | 68 65 20 64 65 73 69 67 | using t|he desig|
|00002440| 6e 61 74 65 64 20 74 72 | 61 6e 73 66 65 72 20 6d |nated tr|ansfer m|
|00002450| 6f 64 65 2e 0d 0d 73 72 | 63 52 65 63 74 3a 0d 20 |ode...sr|cRect:. |
|00002460| 20 20 20 54 68 69 73 20 | 69 73 20 69 6e 69 74 69 | This |is initi|
|00002470| 61 6c 6c 79 20 61 6e 20 | 65 6d 70 74 79 20 72 65 |ally an |empty re|
|00002480| 63 74 2e 20 20 49 66 20 | 74 68 69 73 20 73 72 63 |ct. If |this src|
|00002490| 52 65 63 74 20 69 73 20 | 65 6d 70 74 79 2c 20 74 |Rect is |empty, t|
|000024a0| 68 65 6e 20 74 68 65 20 | 70 6f 72 74 52 65 63 74 |hen the |portRect|
|000024b0| 20 6f 66 20 74 68 65 0d | 20 20 20 20 47 57 6f 72 | of the.| GWor|
|000024c0| 6c 64 20 69 73 20 75 73 | 65 64 20 61 73 20 74 68 |ld is us|ed as th|
|000024d0| 65 20 73 72 63 52 65 63 | 74 2e 20 20 54 68 69 73 |e srcRec|t. This|
|000024e0| 20 6d 65 61 6e 73 20 74 | 68 65 20 64 65 66 61 75 | means t|he defau|
|000024f0| 6c 74 20 73 72 63 52 65 | 63 74 20 69 73 20 74 68 |lt srcRe|ct is th|
|00002500| 65 20 65 6e 74 69 72 65 | 20 47 57 6f 72 6c 64 2e |e entire| GWorld.|
|00002510| 0d 20 20 20 20 49 66 20 | 74 68 69 73 20 66 69 65 |. If |this fie|
|00002520| 6c 64 20 69 73 20 73 65 | 74 20 74 6f 20 61 20 6e |ld is se|t to a n|
|00002530| 6f 6e 2d 65 6d 70 74 79 | 20 72 65 63 74 2c 20 74 |on-empty| rect, t|
|00002540| 68 65 20 64 65 66 61 75 | 6c 74 20 75 70 64 61 74 |he defau|lt updat|
|00002550| 65 20 62 65 68 61 76 69 | 6f 72 20 69 73 20 74 6f |e behavi|or is to|
|00002560| 20 64 6f 20 61 20 43 6f | 70 79 42 69 74 73 0d 20 | do a Co|pyBits. |
|00002570| 20 20 20 6f 66 20 6a 75 | 73 74 20 74 68 65 20 73 | of ju|st the s|
|00002580| 72 63 52 65 63 74 20 61 | 72 65 61 2c 20 61 6e 64 |rcRect a|rea, and|
|00002590| 20 6e 6f 74 20 74 68 65 | 20 65 6e 74 69 72 65 20 | not the| entire |
|000025a0| 47 57 6f 72 6c 64 2e 20 | 20 28 52 65 6d 65 6d 62 |GWorld. | (Rememb|
|000025b0| 65 72 2c 20 74 68 65 20 | 43 6f 70 79 42 69 74 73 |er, the |CopyBits|
|000025c0| 20 69 73 20 64 6f 6e 65 | 20 62 79 0d 20 20 20 20 | is done| by. |
|000025d0| 74 68 65 20 61 62 6f 76 | 65 20 6c 61 79 65 72 2c |the abov|e layer,|
|000025e0| 20 73 6f 20 6f 6e 6c 79 | 20 69 66 20 74 68 65 20 | so only| if the |
|000025f0| 61 62 6f 76 65 20 6c 61 | 79 65 72 20 75 73 65 73 |above la|yer uses|
|00002600| 20 74 68 65 20 64 65 66 | 61 75 6c 74 20 75 70 64 | the def|ault upd|
|00002610| 61 74 65 20 62 65 68 61 | 76 69 6f 72 20 64 6f 65 |ate beha|vior doe|
|00002620| 73 20 74 68 69 73 0d 20 | 20 20 20 6f 63 63 75 72 |s this. | occur|
|00002630| 20 61 75 74 6f 6d 61 74 | 69 63 61 6c 6c 79 2e 29 | automat|ically.)|
|00002640| 0d 20 20 20 20 48 61 76 | 69 6e 67 20 61 20 73 72 |. Hav|ing a sr|
|00002650| 63 52 65 63 74 20 73 6d | 61 6c 6c 65 72 20 74 68 |cRect sm|aller th|
|00002660| 61 6e 20 74 68 65 20 65 | 6e 74 69 72 65 20 47 57 |an the e|ntire GW|
|00002670| 6f 72 6c 64 20 61 6c 6c | 6f 77 73 20 66 6f 72 20 |orld all|ows for |
|00002680| 61 64 64 69 74 69 6f 6e | 61 6c 20 65 66 66 65 63 |addition|al effec|
|00002690| 74 73 2c 20 73 75 63 68 | 20 61 73 0d 20 20 20 20 |ts, such| as. |
|000026a0| 66 61 74 2d 62 69 74 73 | 2e 20 20 49 66 20 74 68 |fat-bits|. If th|
|000026b0| 65 20 73 72 63 52 65 63 | 74 20 66 6f 72 20 74 68 |e srcRec|t for th|
|000026c0| 69 73 20 6c 61 79 65 72 | 20 69 73 20 73 6d 61 6c |is layer| is smal|
|000026d0| 6c 65 72 20 74 68 61 6e | 20 74 68 65 20 64 73 74 |ler than| the dst|
|000026e0| 52 65 63 74 20 6f 66 20 | 74 68 65 20 61 62 6f 76 |Rect of |the abov|
|000026f0| 65 20 6c 61 79 65 72 2c | 0d 20 20 20 20 43 6f 70 |e layer,|. Cop|
|00002700| 79 42 69 74 73 20 77 69 | 6c 6c 20 74 72 61 6e 73 |yBits wi|ll trans|
|00002710| 66 65 72 20 61 20 73 6d | 61 6c 6c 20 72 65 63 74 |fer a sm|all rect|
|00002720| 20 69 6e 74 6f 20 61 20 | 62 69 67 20 72 65 63 74 | into a |big rect|
|00002730| 2e 20 20 54 68 65 20 69 | 6d 61 67 65 20 77 69 6c |. The i|mage wil|
|00002740| 6c 20 62 65 20 73 63 61 | 6c 65 64 20 74 6f 0d 20 |l be sca|led to. |
|00002750| 20 20 20 61 63 63 6f 6d | 6d 6f 64 61 74 65 20 74 | accom|modate t|
|00002760| 68 65 20 6c 61 72 67 65 | 72 20 64 65 73 74 69 6e |he large|r destin|
|00002770| 61 74 69 6f 6e 20 72 65 | 63 74 2c 20 61 6e 64 20 |ation re|ct, and |
|00002780| 70 72 65 73 74 6f 20 2d | 2d 20 66 61 74 2d 62 69 |presto -|- fat-bi|
|00002790| 74 73 21 21 0d 0d 64 73 | 74 52 65 63 74 3a 0d 20 |ts!!..ds|tRect:. |
|000027a0| 20 20 20 54 68 69 73 20 | 66 69 65 6c 64 20 69 73 | This |field is|
|000027b0| 20 69 6e 69 74 69 61 6c | 6c 79 20 61 6e 20 65 6d | initial|ly an em|
|000027c0| 70 74 79 20 72 65 63 74 | 2c 20 6a 75 73 74 20 6c |pty rect|, just l|
|000027d0| 69 6b 65 20 73 72 63 52 | 65 63 74 2e 20 20 49 66 |ike srcR|ect. If|
|000027e0| 20 64 73 74 52 65 63 74 | 20 69 73 20 73 65 74 20 | dstRect| is set |
|000027f0| 74 6f 20 61 0d 20 20 20 | 20 6e 6f 6e 2d 65 6d 70 |to a. | non-emp|
|00002800| 74 79 20 72 65 63 74 2c | 20 74 68 65 6e 20 74 68 |ty rect,| then th|
|00002810| 65 20 64 65 66 61 75 6c | 74 20 75 70 64 61 74 65 |e defaul|t update|
|00002820| 20 62 65 68 61 76 69 6f | 72 20 77 69 6c 6c 20 43 | behavio|r will C|
|00002830| 6f 70 79 42 69 74 73 20 | 6f 6e 6c 79 20 69 6e 74 |opyBits |only int|
|00002840| 6f 20 74 68 69 73 20 61 | 72 65 61 2e 0d 20 20 20 |o this a|rea.. |
|00002850| 20 54 68 69 73 20 61 6c | 6c 6f 77 73 20 74 61 72 | This al|lows tar|
|00002860| 67 65 74 69 6e 67 20 6f | 66 20 61 20 73 70 65 63 |geting o|f a spec|
|00002870| 69 66 69 63 20 70 6f 72 | 74 69 6f 6e 20 6f 66 20 |ific por|tion of |
|00002880| 61 20 77 69 6e 64 6f 77 | 20 66 6f 72 20 6f 66 66 |a window| for off|
|00002890| 73 63 72 65 65 6e 20 75 | 70 64 61 74 69 6e 67 2c |screen u|pdating,|
|000028a0| 20 77 68 69 6c 65 0d 20 | 20 20 20 74 68 65 20 72 | while. | the r|
|000028b0| 65 73 74 20 6f 66 20 74 | 68 65 20 77 69 6e 64 6f |est of t|he windo|
|000028c0| 77 20 63 61 6e 20 62 65 | 20 75 73 65 64 20 66 72 |w can be| used fr|
|000028d0| 6f 6d 20 73 63 72 6f 6c | 6c 62 61 72 73 2c 20 6f |om scrol|lbars, o|
|000028e0| 72 20 73 6f 6d 65 20 73 | 75 63 68 20 6f 74 68 65 |r some s|uch othe|
|000028f0| 72 20 74 68 69 6e 67 2e | 0d 0d 74 68 69 73 52 65 |r thing.|..thisRe|
|00002900| 63 74 3a 0d 20 20 20 20 | 54 68 69 73 20 66 69 65 |ct:. |This fie|
|00002910| 6c 64 20 69 73 20 61 6c | 73 6f 20 69 6e 69 74 69 |ld is al|so initi|
|00002920| 61 6c 6c 79 20 61 6e 20 | 65 6d 70 74 79 20 72 65 |ally an |empty re|
|00002930| 63 74 2e 20 20 54 68 69 | 73 20 66 69 65 6c 64 20 |ct. Thi|s field |
|00002940| 62 65 63 6f 6d 65 73 20 | 6e 6f 6e 2d 65 6d 70 74 |becomes |non-empt|
|00002950| 79 20 62 79 0d 20 20 20 | 20 63 61 6c 6c 69 6e 67 |y by. | calling|
|00002960| 20 49 6e 76 61 6c 4c 61 | 79 65 72 2e 20 20 49 6e | InvalLa|yer. In|
|00002970| 76 61 6c 4c 61 79 65 72 | 20 75 6e 69 6f 6e 73 20 |valLayer| unions |
|00002980| 74 68 65 20 72 65 63 74 | 20 70 61 73 73 65 64 20 |the rect| passed |
|00002990| 74 6f 20 69 74 20 69 6e | 74 6f 20 74 68 69 73 52 |to it in|to thisR|
|000029a0| 65 63 74 20 61 6e 64 0d | 20 20 20 20 73 74 6f 72 |ect and.| stor|
|000029b0| 65 73 20 74 68 65 20 72 | 65 73 75 6c 74 20 69 6e |es the r|esult in|
|000029c0| 20 74 68 69 73 52 65 63 | 74 2e 20 20 49 74 20 74 | thisRec|t. It t|
|000029d0| 68 65 6e 20 63 61 6c 6c | 73 20 69 74 73 65 6c 66 |hen call|s itself|
|000029e0| 20 69 66 20 74 68 65 72 | 65 20 69 73 20 61 20 62 | if ther|e is a b|
|000029f0| 65 6c 6f 77 20 6c 61 79 | 65 72 2c 20 74 68 75 73 |elow lay|er, thus|
|00002a00| 0d 20 20 20 20 72 65 63 | 75 72 73 69 76 65 6c 79 |. rec|ursively|
|00002a10| 20 63 68 61 6e 67 69 6e | 67 20 74 68 69 73 52 65 | changin|g thisRe|
|00002a20| 63 74 20 66 6f 72 20 61 | 6c 6c 20 6c 61 79 65 72 |ct for a|ll layer|
|00002a30| 73 20 62 65 6c 6f 77 20 | 69 74 20 69 6e 20 74 68 |s below |it in th|
|00002a40| 65 20 6c 61 79 65 72 20 | 68 69 65 72 61 72 63 68 |e layer |hierarch|
|00002a50| 79 2e 0d 0d 6c 61 73 74 | 52 65 63 74 3a 0d 20 20 |y...last|Rect:. |
|00002a60| 20 20 54 68 69 73 20 66 | 69 65 6c 64 20 69 73 20 | This f|ield is |
|00002a70| 61 6c 73 6f 20 69 6e 69 | 74 69 61 6c 6c 79 20 61 |also ini|tially a|
|00002a80| 6e 20 65 6d 70 74 79 20 | 72 65 63 74 2e 20 20 54 |n empty |rect. T|
|00002a90| 68 69 73 20 66 69 65 6c | 64 20 62 65 63 6f 6d 65 |his fiel|d become|
|00002aa0| 73 20 6e 6f 6e 2d 65 6d | 70 74 79 20 61 66 74 65 |s non-em|pty afte|
|00002ab0| 72 0d 20 20 20 20 74 68 | 69 73 52 65 63 74 20 69 |r. th|isRect i|
|00002ac0| 73 20 6e 6f 6e 2d 65 6d | 70 74 79 20 61 6e 64 20 |s non-em|pty and |
|00002ad0| 74 68 65 6e 20 55 70 64 | 61 74 65 4c 61 79 65 72 |then Upd|ateLayer|
|00002ae0| 20 69 73 20 63 61 6c 6c | 65 64 2e 20 20 4f 6e 63 | is call|ed. Onc|
|00002af0| 65 20 74 68 65 20 75 70 | 64 61 74 65 20 69 73 20 |e the up|date is |
|00002b00| 64 6f 6e 65 2c 0d 20 20 | 20 20 74 68 69 73 52 65 |done,. | thisRe|
|00002b10| 63 74 20 69 73 20 63 6f | 70 69 65 64 20 69 6e 74 |ct is co|pied int|
|00002b20| 6f 20 6c 61 73 74 52 65 | 63 74 2c 20 61 6e 64 20 |o lastRe|ct, and |
|00002b30| 74 68 65 6e 20 74 68 69 | 73 52 65 63 74 20 69 73 |then thi|sRect is|
|00002b40| 20 73 65 74 20 65 6d 70 | 74 79 20 6f 6e 63 65 20 | set emp|ty once |
|00002b50| 61 67 61 69 6e 2e 0d 20 | 20 20 20 54 68 65 20 6c |again.. | The l|
|00002b60| 61 73 74 52 65 63 74 20 | 66 69 65 6c 64 20 69 73 |astRect |field is|
|00002b70| 20 75 73 65 20 74 6f 20 | 6f 70 74 69 6f 6e 61 6c | use to |optional|
|00002b80| 6c 79 20 63 6f 6d 62 69 | 6e 65 20 75 70 64 61 74 |ly combi|ne updat|
|00002b90| 69 6e 67 20 74 68 65 20 | 6c 61 73 74 20 75 70 64 |ing the |last upd|
|00002ba0| 61 74 65 20 77 69 74 68 | 20 74 68 65 0d 20 20 20 |ate with| the. |
|00002bb0| 20 63 75 72 72 65 6e 74 | 20 75 70 64 61 74 65 2e | current| update.|
|00002bc0| 20 20 54 68 69 73 20 69 | 73 20 70 61 72 74 69 63 | This i|s partic|
|00002bd0| 75 6c 61 72 6c 79 20 75 | 73 65 66 75 6c 20 66 6f |ularly u|seful fo|
|00002be0| 72 20 64 72 61 67 67 69 | 6e 67 20 6f 62 6a 65 63 |r draggi|ng objec|
|00002bf0| 74 73 2c 20 61 73 20 64 | 65 73 63 72 69 62 65 64 |ts, as d|escribed|
|00002c00| 20 61 62 6f 76 65 2e 0d | 20 20 20 20 49 6e 20 61 | above..| In a|
|00002c10| 20 73 69 6e 67 6c 65 20 | 43 6f 70 79 42 69 74 73 | single |CopyBits|
|00002c20| 2c 20 74 68 65 20 6f 6c | 64 20 6c 6f 63 61 74 69 |, the ol|d locati|
|00002c30| 6f 6e 20 61 6e 64 20 74 | 68 65 20 6e 65 77 20 6c |on and t|he new l|
|00002c40| 6f 63 61 74 69 6f 6e 20 | 6e 65 65 64 20 74 6f 20 |ocation |need to |
|00002c50| 62 65 20 64 72 61 77 6e | 20 69 6e 20 74 68 65 0d |be drawn| in the.|
|00002c60| 20 20 20 20 77 69 6e 64 | 6f 77 2e 20 20 42 79 20 | wind|ow. By |
|00002c70| 73 65 74 74 69 6e 67 20 | 69 6e 63 6c 75 64 65 4c |setting |includeL|
|00002c80| 61 73 74 55 70 64 61 74 | 65 20 74 72 75 65 2c 20 |astUpdat|e true, |
|00002c90| 74 68 69 73 20 69 73 20 | 64 6f 6e 65 20 61 75 74 |this is |done aut|
|00002ca0| 6f 6d 61 74 69 63 61 6c | 6c 79 20 62 79 20 74 68 |omatical|ly by th|
|00002cb0| 65 20 64 65 66 61 75 6c | 74 0d 20 20 20 20 75 70 |e defaul|t. up|
|00002cc0| 64 61 74 65 20 62 65 68 | 61 76 69 6f 72 2e 0d 0d |date beh|avior...|
|00002cd0| 69 6e 63 6c 75 64 65 4c | 61 73 74 55 70 64 61 74 |includeL|astUpdat|
|00002ce0| 65 3a 0d 20 20 20 20 41 | 73 20 6a 75 73 74 20 64 |e:. A|s just d|
|00002cf0| 65 73 63 72 69 62 65 64 | 20 66 6f 72 20 74 68 65 |escribed| for the|
|00002d00| 20 6c 61 73 74 52 65 63 | 74 20 66 69 65 6c 64 2c | lastRec|t field,|
|00002d10| 20 69 66 20 74 68 69 73 | 20 66 69 65 6c 64 20 69 | if this| field i|
|00002d20| 73 20 74 72 75 65 2c 20 | 74 68 65 6e 20 74 68 65 |s true, |then the|
|00002d30| 20 64 65 66 61 75 6c 74 | 0d 20 20 20 20 75 70 64 | default|. upd|
|00002d40| 61 74 65 20 62 65 68 61 | 76 69 6f 72 20 43 6f 70 |ate beha|vior Cop|
|00002d50| 79 42 69 74 73 20 69 6e | 63 6c 75 64 65 73 20 62 |yBits in|cludes b|
|00002d60| 6f 74 68 20 74 68 65 20 | 6c 61 73 74 20 75 70 64 |oth the |last upd|
|00002d70| 61 74 65 20 61 6e 64 20 | 74 68 69 73 20 75 70 64 |ate and |this upd|
|00002d80| 61 74 65 2c 20 74 68 75 | 73 20 67 65 6e 65 72 61 |ate, thu|s genera|
|00002d90| 74 69 6e 67 0d 20 20 20 | 20 73 6d 6f 6f 74 68 20 |ting. | smooth |
|00002da0| 61 6e 69 6d 61 74 69 6f | 6e 20 65 66 66 65 63 74 |animatio|n effect|
|00002db0| 73 2e 0d 0d 0d 41 20 63 | 61 6c 6c 20 74 6f 20 63 |s....A c|all to c|
|00002dc0| 72 65 61 74 65 20 61 20 | 6c 61 79 65 72 20 66 6f |reate a |layer fo|
|00002dd0| 72 20 61 20 77 69 6e 64 | 6f 77 20 28 74 68 65 20 |r a wind|ow (the |
|00002de0| 74 6f 70 2d 6d 6f 73 74 | 20 6c 61 79 65 72 2c 20 |top-most| layer, |
|00002df0| 6d 6f 73 74 20 6c 69 6b | 65 6c 79 29 20 6d 69 67 |most lik|ely) mig|
|00002e00| 68 74 20 6c 6f 6f 6b 20 | 6c 69 6b 65 20 74 68 69 |ht look |like thi|
|00002e10| 73 3a 0d 0d 20 20 20 20 | 4e 65 77 4c 61 79 65 72 |s:.. |NewLayer|
|00002e20| 28 26 77 69 6e 64 6f 77 | 4c 61 79 65 72 2c 20 20 |(&window|Layer, |
|00002e30| 20 20 4c 61 79 65 72 20 | 6f 62 6a 65 63 74 20 68 | Layer |object h|
|00002e40| 61 6e 64 6c 65 20 69 73 | 20 72 65 74 75 72 6e 65 |andle is| returne|
|00002e50| 64 20 68 65 72 65 2e 0d | 20 20 20 20 20 20 20 20 |d here..| |
|00002e60| 20 20 20 20 20 20 6e 69 | 6c 2c 20 20 20 20 20 20 | ni|l, |
|00002e70| 20 20 20 20 20 20 54 6f | 70 20 6c 61 79 65 72 2c | To|p layer,|
|00002e80| 20 73 6f 20 74 68 65 72 | 65 20 69 73 20 6e 6f 20 | so ther|e is no |
|00002e90| 61 62 6f 76 65 20 6c 61 | 79 65 72 2e 0d 20 20 20 |above la|yer.. |
|00002ea0| 20 20 20 20 20 20 20 20 | 20 20 20 6e 69 6c 2c 20 | | nil, |
|00002eb0| 20 20 20 20 20 20 20 20 | 20 20 20 55 73 65 73 20 | | Uses |
|00002ec0| 64 65 66 61 75 6c 74 20 | 6c 61 79 65 72 20 70 72 |default |layer pr|
|00002ed0| 6f 63 65 64 75 72 65 2e | 0d 20 20 20 20 20 20 20 |ocedure.|. |
|00002ee0| 20 20 20 20 20 20 20 77 | 69 6e 64 6f 77 2c 20 20 | w|indow, |
|00002ef0| 20 20 20 20 20 20 20 57 | 69 6e 64 6f 77 20 75 73 | W|indow us|
|00002f00| 65 64 20 62 79 20 74 68 | 65 20 6c 61 79 65 72 20 |ed by th|e layer |
|00002f10| 6f 62 6a 65 63 74 2e 0d | 20 20 20 20 20 20 20 20 |object..| |
|00002f20| 20 20 20 20 20 20 30 2c | 20 20 20 20 20 20 20 20 | 0,| |
|00002f30| 20 20 20 20 20 20 44 65 | 70 74 68 20 66 6f 72 20 | De|pth for |
|00002f40| 6f 66 66 73 63 72 65 65 | 6e 20 30 20 66 6f 72 20 |offscree|n 0 for |
|00002f50| 73 63 72 65 65 6e 20 64 | 65 70 74 68 29 2e 0d 20 |screen d|epth).. |
|00002f60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 30 29 3b | | 0);|
|00002f70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 43 75 73 | | Cus|
|00002f80| 74 6f 6d 20 6c 61 79 65 | 72 20 69 6e 69 74 20 64 |tom laye|r init d|
|00002f90| 61 74 61 2c 20 69 66 20 | 61 6e 79 2e 0d 0d 49 66 |ata, if |any...If|
|00002fa0| 20 4e 65 77 4c 61 79 65 | 72 20 73 75 63 63 65 65 | NewLaye|r succee|
|00002fb0| 64 73 2c 20 74 68 65 20 | 6c 61 79 65 72 20 6f 62 |ds, the |layer ob|
|00002fc0| 6a 65 63 74 20 68 61 6e | 64 6c 65 20 69 73 20 72 |ject han|dle is r|
|00002fd0| 65 74 75 72 6e 65 64 20 | 69 6e 20 77 69 6e 64 6f |eturned |in windo|
|00002fe0| 77 4c 61 79 65 72 2e 20 | 20 49 66 20 69 74 20 66 |wLayer. | If it f|
|00002ff0| 61 69 6c 73 2c 0d 6e 69 | 6c 20 69 73 20 72 65 74 |ails,.ni|l is ret|
|00003000| 75 72 6e 65 64 20 69 6e | 20 77 69 6e 64 6f 77 4c |urned in| windowL|
|00003010| 61 79 65 72 2c 20 70 6c | 75 73 20 61 6e 20 65 72 |ayer, pl|us an er|
|00003020| 72 6f 72 20 69 73 20 72 | 65 74 75 72 6e 65 64 2e |ror is r|eturned.|
|00003030| 20 20 54 68 69 73 20 63 | 61 6c 6c 20 63 61 6e 20 | This c|all can |
|00003040| 68 61 72 64 6c 79 20 66 | 61 69 6c 2c 20 61 73 0d |hardly f|ail, as.|
|00003050| 74 68 65 72 65 20 69 73 | 20 6e 6f 20 6f 66 66 73 |there is| no offs|
|00003060| 63 72 65 65 6e 20 47 57 | 6f 72 6c 64 20 63 72 65 |creen GW|orld cre|
|00003070| 61 74 65 64 2e 20 20 49 | 66 20 6f 6e 6c 79 20 61 |ated. I|f only a|
|00003080| 20 6d 69 6e 69 6d 61 6c | 6c 79 2d 73 69 7a 65 64 | minimal|ly-sized|
|00003090| 20 68 61 6e 64 6c 65 20 | 63 61 6e 20 62 65 20 63 | handle |can be c|
|000030a0| 72 65 61 74 65 64 2c 20 | 69 74 0d 77 69 6c 6c 20 |reated, |it.will |
|000030b0| 73 75 63 63 65 65 64 2e | 0d 0d 54 6f 20 63 72 65 |succeed.|..To cre|
|000030c0| 61 74 65 20 61 20 77 6f | 72 6b 20 6c 61 79 65 72 |ate a wo|rk layer|
|000030d0| 20 62 65 6c 6f 77 20 74 | 68 69 73 20 77 69 6e 64 | below t|his wind|
|000030e0| 6f 77 20 6c 61 79 65 72 | 2c 20 77 65 20 6d 69 67 |ow layer|, we mig|
|000030f0| 68 74 20 6d 61 6b 65 20 | 61 20 63 61 6c 6c 20 73 |ht make |a call s|
|00003100| 75 63 68 20 61 73 3a 0d | 0d 20 20 20 20 65 72 72 |uch as:.|. err|
|00003110| 20 3d 20 4e 65 77 4c 61 | 79 65 72 28 26 77 6f 72 | = NewLa|yer(&wor|
|00003120| 6b 4c 61 79 65 72 2c 20 | 77 69 6e 64 6f 77 4c 61 |kLayer, |windowLa|
|00003130| 79 65 72 2c 20 57 6f 72 | 6b 4c 61 79 65 72 50 72 |yer, Wor|kLayerPr|
|00003140| 6f 63 2c 20 6e 69 6c 2c | 20 30 2c 20 28 6c 6f 6e |oc, nil,| 0, (lon|
|00003150| 67 29 26 6d 79 49 6e 66 | 6f 29 3b 0d 20 20 20 20 |g)&myInf|o);. |
|00003160| 20 20 20 20 20 20 20 20 | 6d 79 49 6e 66 6f 20 69 | |myInfo i|
|00003170| 73 20 61 20 73 74 72 75 | 63 74 20 74 68 61 74 20 |s a stru|ct that |
|00003180| 68 6f 6c 64 73 20 69 6e | 66 6f 72 6d 61 74 69 6f |holds in|formatio|
|00003190| 6e 20 74 68 61 74 20 57 | 6f 72 6b 4c 61 79 65 72 |n that W|orkLayer|
|000031a0| 50 72 6f 63 0d 20 20 20 | 20 20 20 20 20 20 20 20 |Proc. | |
|000031b0| 20 6e 65 65 64 73 20 74 | 6f 20 72 65 66 65 72 65 | needs t|o refere|
|000031c0| 6e 63 65 20 66 6f 72 20 | 64 72 61 77 69 6e 67 20 |nce for |drawing |
|000031d0| 74 68 65 20 6f 62 6a 65 | 63 74 20 69 6e 20 74 68 |the obje|ct in th|
|000031e0| 65 20 6e 65 77 20 6c 6f | 63 61 74 69 6f 6e 2e 0d |e new lo|cation..|
|000031f0| 0d 54 68 69 73 20 63 61 | 6c 6c 20 68 61 73 20 61 |.This ca|ll has a|
|00003200| 20 67 72 65 61 74 65 72 | 20 63 68 61 6e 63 65 20 | greater| chance |
|00003210| 6f 66 20 66 61 69 6c 75 | 72 65 2c 20 61 73 20 61 |of failu|re, as a|
|00003220| 6e 20 6f 66 66 73 63 72 | 65 65 6e 20 47 57 6f 72 |n offscr|een GWor|
|00003230| 6c 64 20 77 61 73 20 63 | 72 65 61 74 65 64 20 66 |ld was c|reated f|
|00003240| 6f 72 20 69 74 2e 0d 57 | 65 20 70 61 73 73 65 64 |or it..W|e passed|
|00003250| 20 69 74 20 61 20 6e 69 | 6c 20 67 72 61 66 50 6f | it a ni|l grafPo|
|00003260| 72 74 2c 20 73 6f 20 74 | 68 65 20 64 65 66 61 75 |rt, so t|he defau|
|00003270| 6c 74 20 69 6e 69 74 69 | 61 6c 69 7a 61 74 69 6f |lt initi|alizatio|
|00003280| 6e 20 62 65 68 61 76 69 | 6f 72 20 6b 6e 6f 77 73 |n behavi|or knows|
|00003290| 20 74 68 61 74 20 69 74 | 20 77 69 6c 6c 0d 68 61 | that it| will.ha|
|000032a0| 76 65 20 74 6f 20 63 72 | 65 61 74 65 20 61 20 47 |ve to cr|eate a G|
|000032b0| 57 6f 72 6c 64 2e 20 20 | 54 68 65 20 64 65 66 61 |World. |The defa|
|000032c0| 75 6c 74 20 69 6e 69 74 | 69 61 6c 69 7a 61 74 69 |ult init|ializati|
|000032d0| 6f 6e 20 62 65 68 61 76 | 69 6f 72 20 75 73 65 73 |on behav|ior uses|
|000032e0| 20 64 73 74 52 65 63 74 | 20 6f 66 20 74 68 65 20 | dstRect| of the |
|000032f0| 61 62 6f 76 65 0d 6c 61 | 79 65 72 20 61 73 20 74 |above.la|yer as t|
|00003300| 68 65 20 73 69 7a 65 20 | 6f 66 20 74 68 65 20 6f |he size |of the o|
|00003310| 66 66 73 63 72 65 65 6e | 20 47 57 6f 72 6c 64 20 |ffscreen| GWorld |
|00003320| 69 74 20 69 73 20 74 6f | 20 63 72 65 61 74 65 2e |it is to| create.|
|00003330| 20 20 49 66 20 64 73 74 | 52 65 63 74 20 69 73 20 | If dst|Rect is |
|00003340| 61 6e 20 65 6d 70 74 79 | 20 72 65 63 74 2c 0d 74 |an empty| rect,.t|
|00003350| 68 65 6e 20 69 74 20 75 | 73 65 73 20 74 68 65 20 |hen it u|ses the |
|00003360| 70 6f 72 74 52 65 63 74 | 20 6f 66 20 74 68 65 20 |portRect| of the |
|00003370| 61 62 6f 76 65 20 6c 61 | 79 65 72 20 69 6e 73 74 |above la|yer inst|
|00003380| 65 61 64 2e 20 20 53 6f | 20 69 66 20 79 6f 75 20 |ead. So| if you |
|00003390| 77 61 6e 74 65 64 20 74 | 6f 20 6d 61 70 20 74 68 |wanted t|o map th|
|000033a0| 65 20 6f 66 66 73 63 72 | 65 65 6e 0d 6c 61 79 65 |e offscr|een.laye|
|000033b0| 72 20 74 6f 20 6a 75 73 | 74 20 61 20 70 6f 72 74 |r to jus|t a port|
|000033c0| 69 6f 6e 20 6f 66 20 74 | 68 65 20 77 69 6e 64 6f |ion of t|he windo|
|000033d0| 77 2c 20 79 6f 75 20 77 | 6f 75 6c 64 20 73 65 74 |w, you w|ould set|
|000033e0| 20 74 68 65 20 64 73 74 | 52 65 63 74 20 66 6f 72 | the dst|Rect for|
|000033f0| 20 74 68 65 20 74 6f 70 | 2d 6d 6f 73 74 20 6c 61 | the top|-most la|
|00003400| 79 65 72 0d 70 72 69 6f | 72 20 74 6f 20 63 72 65 |yer.prio|r to cre|
|00003410| 61 74 69 6e 67 20 74 68 | 65 20 6d 69 64 64 6c 65 |ating th|e middle|
|00003420| 20 6c 61 79 65 72 2e 0d | 0d 49 4d 50 4f 52 54 41 | layer..|.IMPORTA|
|00003430| 4e 54 3a 20 20 54 68 65 | 20 64 65 66 61 75 6c 74 |NT: The| default|
|00003440| 20 62 65 68 61 76 69 6f | 72 20 61 75 74 6f 6d 61 | behavio|r automa|
|00003450| 74 69 63 61 6c 6c 79 20 | 63 72 65 61 74 65 73 20 |tically |creates |
|00003460| 74 68 65 20 6f 66 66 73 | 63 72 65 65 6e 20 47 57 |the offs|creen GW|
|00003470| 6f 72 6c 64 20 74 6f 20 | 74 68 65 20 64 65 73 63 |orld to |the desc|
|00003480| 72 69 62 65 64 0d 20 20 | 20 20 20 20 20 20 20 20 |ribed. | |
|00003490| 20 20 73 69 7a 65 2e 20 | 20 57 65 20 68 61 76 65 | size. | We have|
|000034a0| 20 70 61 73 73 65 64 20 | 4e 65 77 4c 61 79 65 72 | passed |NewLayer|
|000034b0| 20 61 20 6c 61 79 65 72 | 20 70 72 6f 63 65 64 75 | a layer| procedu|
|000034c0| 72 65 2c 20 73 6f 20 77 | 65 20 64 6f 6e 27 74 20 |re, so w|e don't |
|000034d0| 61 75 74 6f 6d 61 74 69 | 63 61 6c 6c 79 20 67 65 |automati|cally ge|
|000034e0| 74 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 74 68 |t. | th|
|000034f0| 65 20 64 65 66 61 75 6c | 74 20 62 65 68 61 76 69 |e defaul|t behavi|
|00003500| 6f 72 73 20 66 6f 72 20 | 74 68 65 20 6d 69 64 64 |ors for |the midd|
|00003510| 6c 65 20 6c 61 79 65 72 | 2e 20 20 54 68 69 73 20 |le layer|. This |
|00003520| 6d 75 73 74 20 62 65 20 | 6b 65 70 74 20 69 6e 20 |must be |kept in |
|00003530| 6d 69 6e 64 20 77 68 65 | 6e 0d 20 20 20 20 20 20 |mind whe|n. |
|00003540| 20 20 20 20 20 20 77 72 | 69 74 69 6e 67 20 74 68 | wr|iting th|
|00003550| 65 20 6c 61 79 65 72 20 | 70 72 6f 63 65 64 75 72 |e layer |procedur|
|00003560| 65 20 66 6f 72 20 74 68 | 65 20 6d 69 64 64 6c 65 |e for th|e middle|
|00003570| 20 6c 61 79 65 72 2e 20 | 20 54 6f 20 67 65 74 20 | layer. | To get |
|00003580| 74 68 65 20 64 65 66 61 | 75 6c 74 20 62 65 68 61 |the defa|ult beha|
|00003590| 76 69 6f 72 2c 0d 20 20 | 20 20 20 20 20 20 20 20 |vior,. | |
|000035a0| 20 20 77 65 20 73 69 6d | 70 6c 79 20 63 61 6c 6c | we sim|ply call|
|000035b0| 20 44 65 66 61 75 6c 74 | 4c 61 79 65 72 49 6e 69 | Default|LayerIni|
|000035c0| 74 20 77 68 65 6e 20 74 | 68 65 20 6c 61 79 65 72 |t when t|he layer|
|000035d0| 20 70 72 6f 63 65 64 75 | 72 65 20 67 65 74 73 20 | procedu|re gets |
|000035e0| 61 6e 20 69 6e 69 74 69 | 61 6c 69 7a 61 74 69 6f |an initi|alizatio|
|000035f0| 6e 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 6d 65 |n. | me|
|00003600| 73 73 61 67 65 2e 20 20 | 53 69 6e 63 65 20 74 68 |ssage. |Since th|
|00003610| 65 20 64 65 66 61 75 6c | 74 20 69 6e 69 74 69 61 |e defaul|t initia|
|00003620| 6c 69 7a 61 74 69 6f 6e | 20 62 65 68 61 76 69 6f |lization| behavio|
|00003630| 72 20 69 73 20 65 78 61 | 63 74 6c 79 20 77 68 61 |r is exa|ctly wha|
|00003640| 74 20 77 65 20 77 61 6e | 74 2c 20 77 65 0d 20 20 |t we wan|t, we. |
|00003650| 20 20 20 20 20 20 20 20 | 20 20 6a 75 73 74 20 63 | | just c|
|00003660| 61 6c 6c 20 69 74 20 64 | 69 72 65 63 74 6c 79 2e |all it d|irectly.|
|00003670| 0d 0d 54 68 65 20 72 65 | 61 73 6f 6e 20 74 68 61 |..The re|ason tha|
|00003680| 74 20 77 65 20 68 61 76 | 65 20 61 20 6c 61 79 65 |t we hav|e a laye|
|00003690| 72 20 70 72 6f 63 65 64 | 75 72 65 20 66 6f 72 20 |r proced|ure for |
|000036a0| 74 68 69 73 20 6c 61 79 | 65 72 20 69 73 20 74 68 |this lay|er is th|
|000036b0| 61 74 20 77 65 20 77 61 | 6e 74 20 74 6f 20 64 6f |at we wa|nt to do|
|000036c0| 20 73 6f 6d 65 74 68 69 | 6e 67 0d 64 69 66 66 65 | somethi|ng.diffe|
|000036d0| 72 65 6e 74 20 77 68 65 | 6e 20 77 65 20 72 65 63 |rent whe|n we rec|
|000036e0| 65 69 76 65 20 61 6e 20 | 75 70 64 61 74 65 20 6d |eive an |update m|
|000036f0| 65 73 73 61 67 65 2e 20 | 20 46 6f 72 20 74 68 65 |essage. | For the|
|00003700| 20 75 70 64 61 74 65 20 | 6d 65 73 73 61 67 65 20 | update |message |
|00003710| 77 65 20 77 61 6e 74 20 | 74 6f 20 66 69 72 73 74 |we want |to first|
|00003720| 0d 74 72 61 6e 73 66 65 | 72 20 74 68 65 20 70 6f |.transfe|r the po|
|00003730| 72 74 69 6f 6e 20 6f 66 | 20 62 61 63 6b 67 72 6f |rtion of| backgro|
|00003740| 75 6e 64 20 69 6e 74 6f | 20 74 68 65 20 6d 69 64 |und into| the mid|
|00003750| 64 6c 65 20 6c 61 79 65 | 72 2c 20 61 6e 64 20 74 |dle laye|r, and t|
|00003760| 68 65 6e 20 77 65 20 77 | 61 6e 74 20 74 6f 20 64 |hen we w|ant to d|
|00003770| 72 61 77 20 74 68 65 20 | 6f 62 6a 65 63 74 0d 77 |raw the |object.w|
|00003780| 65 20 61 72 65 20 64 72 | 61 67 67 69 6e 67 20 69 |e are dr|agging i|
|00003790| 6e 74 6f 20 74 68 65 20 | 6d 69 64 64 6c 65 20 6c |nto the |middle l|
|000037a0| 61 79 65 72 2e 20 20 46 | 6f 72 20 74 68 65 20 75 |ayer. F|or the u|
|000037b0| 70 64 61 74 65 20 6d 65 | 73 73 61 67 65 2c 20 77 |pdate me|ssage, w|
|000037c0| 65 20 63 61 6e 20 66 69 | 72 73 74 20 63 61 6c 6c |e can fi|rst call|
|000037d0| 0d 44 65 66 61 75 6c 74 | 4c 61 79 65 72 55 70 64 |.Default|LayerUpd|
|000037e0| 61 74 65 20 74 6f 20 64 | 6f 20 74 68 65 20 43 6f |ate to d|o the Co|
|000037f0| 70 79 42 69 74 73 20 66 | 72 6f 6d 20 74 68 65 20 |pyBits f|rom the |
|00003800| 62 65 6c 6f 77 20 6c 61 | 79 65 72 20 69 6e 74 6f |below la|yer into|
|00003810| 20 74 68 65 20 6d 69 64 | 64 6c 65 20 6c 61 79 65 | the mid|dle laye|
|00003820| 72 2c 20 61 6e 64 20 74 | 68 65 6e 0d 72 69 67 68 |r, and t|hen.righ|
|00003830| 74 20 61 66 74 65 72 20 | 74 68 61 74 20 77 65 20 |t after |that we |
|00003840| 63 61 6e 20 64 72 61 77 | 20 74 68 65 20 6f 62 6a |can draw| the obj|
|00003850| 65 63 74 20 62 65 69 6e | 67 20 64 72 61 67 67 65 |ect bein|g dragge|
|00003860| 64 20 69 6e 74 6f 20 69 | 74 73 20 6e 65 77 20 6c |d into i|ts new l|
|00003870| 6f 63 61 74 69 6f 6e 2e | 20 20 54 68 65 20 6e 65 |ocation.| The ne|
|00003880| 61 74 20 74 68 69 6e 67 | 0d 61 62 6f 75 74 20 74 |at thing|.about t|
|00003890| 68 69 73 20 69 73 20 74 | 68 61 74 20 74 68 65 20 |his is t|hat the |
|000038a0| 64 65 66 61 75 6c 74 20 | 62 65 68 61 76 69 6f 72 |default |behavior|
|000038b0| 20 63 61 6e 20 73 74 69 | 6c 6c 20 63 6f 6d 6d 6f | can sti|ll commo|
|000038c0| 6e 6c 79 20 62 65 20 75 | 73 65 64 2c 20 65 76 65 |nly be u|sed, eve|
|000038d0| 6e 20 69 66 20 74 68 65 | 72 65 20 69 73 20 65 78 |n if the|re is ex|
|000038e0| 74 72 61 0d 73 74 75 66 | 66 20 74 68 61 74 20 77 |tra.stuf|f that w|
|000038f0| 65 20 6e 65 65 64 20 74 | 6f 20 64 6f 2e 0d 0d 41 |e need t|o do...A|
|00003900| 73 73 75 6d 69 6e 67 20 | 6e 6f 20 65 72 72 6f 72 |ssuming |no error|
|00003910| 73 2c 20 77 65 20 6e 6f | 77 20 68 61 76 65 20 61 |s, we no|w have a|
|00003920| 20 74 6f 70 2d 6d 6f 73 | 74 20 6c 61 79 65 72 20 | top-mos|t layer |
|00003930| 72 65 6c 61 74 69 6e 67 | 20 74 6f 20 74 68 65 20 |relating| to the |
|00003940| 74 61 72 67 65 74 20 77 | 69 6e 64 6f 77 2c 20 70 |target w|indow, p|
|00003950| 6c 75 73 20 61 20 6d 69 | 64 64 6c 65 0d 6c 61 79 |lus a mi|ddle.lay|
|00003960| 65 72 20 66 6f 72 20 64 | 6f 69 6e 67 20 74 68 65 |er for d|oing the|
|00003970| 20 6f 66 66 73 63 72 65 | 65 6e 20 64 72 61 77 69 | offscre|en drawi|
|00003980| 6e 67 20 6f 66 20 74 68 | 65 20 6f 62 6a 65 63 74 |ng of th|e object|
|00003990| 20 62 65 69 6e 67 20 64 | 72 61 67 67 65 64 2e 20 | being d|ragged. |
|000039a0| 20 57 65 20 6e 6f 77 20 | 6e 65 65 64 20 61 20 62 | We now |need a b|
|000039b0| 61 63 6b 67 72 6f 75 6e | 64 0d 6c 61 79 65 72 20 |ackgroun|d.layer |
|000039c0| 74 68 61 74 20 68 61 73 | 20 61 6e 20 69 6d 61 67 |that has| an imag|
|000039d0| 65 20 6f 66 20 74 68 65 | 20 62 61 63 6b 67 72 6f |e of the| backgro|
|000039e0| 75 6e 64 20 64 72 61 77 | 6e 20 69 6e 74 6f 20 69 |und draw|n into i|
|000039f0| 74 2e 20 20 54 68 69 73 | 20 63 6f 64 65 20 6d 69 |t. This| code mi|
|00003a00| 67 68 74 20 6c 6f 6f 6b | 20 6c 69 6b 65 3a 0d 0d |ght look| like:..|
|00003a10| 20 20 20 20 69 66 20 28 | 21 65 72 72 29 20 65 72 | if (|!err) er|
|00003a20| 72 20 3d 20 4e 65 77 4c | 61 79 65 72 28 26 62 61 |r = NewL|ayer(&ba|
|00003a30| 63 6b 4c 61 79 65 72 2c | 20 77 6f 72 6b 4c 61 79 |ckLayer,| workLay|
|00003a40| 65 72 2c 20 42 61 63 6b | 4c 61 79 65 72 50 72 6f |er, Back|LayerPro|
|00003a50| 63 2c 20 6e 69 6c 2c 20 | 30 2c 20 28 6c 6f 6e 67 |c, nil, |0, (long|
|00003a60| 29 26 6d 79 49 6e 66 6f | 29 3b 0d 0d 54 68 69 73 |)&myInfo|);..This|
|00003a70| 20 6c 61 79 65 72 20 61 | 6c 73 6f 20 68 61 73 20 | layer a|lso has |
|00003a80| 69 74 73 20 6f 77 6e 20 | 6c 61 79 65 72 20 70 72 |its own |layer pr|
|00003a90| 6f 63 65 64 75 72 65 2e | 20 20 54 68 65 20 72 65 |ocedure.| The re|
|00003aa0| 61 73 6f 6e 69 6e 67 20 | 62 65 68 69 6e 64 20 74 |asoning |behind t|
|00003ab0| 68 69 73 20 69 73 20 74 | 68 61 74 20 74 68 65 0d |his is t|hat the.|
|00003ac0| 69 6e 69 74 69 61 6c 69 | 7a 61 74 69 6f 6e 20 77 |initiali|zation w|
|00003ad0| 6f 75 6c 64 20 64 6f 20 | 74 68 65 20 64 72 61 77 |ould do |the draw|
|00003ae0| 69 6e 67 20 69 6e 74 6f | 20 74 68 65 20 62 61 63 |ing into| the bac|
|00003af0| 6b 67 72 6f 75 6e 64 2e | 20 20 4f 6e 63 65 20 74 |kground.| Once t|
|00003b00| 68 65 20 6c 61 79 65 72 | 73 20 61 72 65 20 61 6c |he layer|s are al|
|00003b10| 6c 20 73 65 74 20 75 70 | 2c 0d 77 65 20 77 61 6e |l set up|,.we wan|
|00003b20| 74 20 74 68 65 20 62 61 | 63 6b 67 72 6f 75 6e 64 |t the ba|ckground|
|00003b30| 20 6c 61 79 65 72 20 74 | 6f 20 62 65 20 66 75 6c | layer t|o be ful|
|00003b40| 6c 79 20 69 6d 61 67 65 | 64 2e 20 20 54 68 69 73 |ly image|d. This|
|00003b50| 20 77 61 79 20 74 68 65 | 72 65 20 69 73 20 6e 6f | way the|re is no|
|00003b60| 20 74 69 6d 65 20 73 70 | 65 6e 74 20 66 6f 72 20 | time sp|ent for |
|00003b70| 74 68 65 0d 62 61 63 6b | 67 72 6f 75 6e 64 20 6c |the.back|ground l|
|00003b80| 61 79 65 72 2c 20 77 68 | 69 63 68 20 69 73 20 74 |ayer, wh|ich is t|
|00003b90| 68 65 20 77 61 79 20 61 | 20 62 61 63 6b 67 72 6f |he way a| backgro|
|00003ba0| 75 6e 64 20 73 68 6f 75 | 6c 64 20 62 65 2e 0d 0d |und shou|ld be...|
|00003bb0| 54 6f 20 72 65 63 61 70 | 2c 20 74 68 65 20 63 6f |To recap|, the co|
|00003bc0| 64 65 20 74 6f 20 63 72 | 65 61 74 65 20 74 68 65 |de to cr|eate the|
|00003bd0| 20 33 20 6c 61 79 65 72 | 73 20 69 73 20 61 73 20 | 3 layer|s is as |
|00003be0| 66 6f 6c 6c 6f 77 73 3a | 0d 0d 20 20 20 20 20 20 |follows:|.. |
|00003bf0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 4e 65 | | Ne|
|00003c00| 77 4c 61 79 65 72 28 26 | 77 69 6e 64 6f 77 4c 61 |wLayer(&|windowLa|
|00003c10| 79 65 72 2c 20 6e 69 6c | 2c 20 6e 69 6c 2c 20 77 |yer, nil|, nil, w|
|00003c20| 69 6e 64 6f 77 2c 20 30 | 2c 20 30 29 3b 0d 20 20 |indow, 0|, 0);. |
|00003c30| 20 20 20 20 20 20 20 20 | 20 20 20 20 65 72 72 20 | | err |
|00003c40| 3d 20 4e 65 77 4c 61 79 | 65 72 28 26 77 6f 72 6b |= NewLay|er(&work|
|00003c50| 4c 61 79 65 72 2c 20 77 | 69 6e 64 6f 77 4c 61 79 |Layer, w|indowLay|
|00003c60| 65 72 2c 20 57 6f 72 6b | 4c 61 79 65 72 50 72 6f |er, Work|LayerPro|
|00003c70| 63 2c 20 6e 69 6c 2c 20 | 30 2c 20 28 6c 6f 6e 67 |c, nil, |0, (long|
|00003c80| 29 26 6d 79 49 6e 66 6f | 29 3b 0d 20 20 20 20 69 |)&myInfo|);. i|
|00003c90| 66 20 28 21 65 72 72 29 | 20 65 72 72 20 3d 20 4e |f (!err)| err = N|
|00003ca0| 65 77 4c 61 79 65 72 28 | 26 62 61 63 6b 4c 61 79 |ewLayer(|&backLay|
|00003cb0| 65 72 2c 20 77 6f 72 6b | 4c 61 79 65 72 2c 20 42 |er, work|Layer, B|
|00003cc0| 61 63 6b 4c 61 79 65 72 | 50 72 6f 63 2c 20 6e 69 |ackLayer|Proc, ni|
|00003cd0| 6c 2c 20 30 2c 20 28 6c | 6f 6e 67 29 26 6d 79 49 |l, 0, (l|ong)&myI|
|00003ce0| 6e 66 6f 29 3b 0d 0d 46 | 6f 72 20 64 72 61 67 67 |nfo);..F|or dragg|
|00003cf0| 69 6e 67 2c 20 77 65 20 | 77 6f 75 6c 64 20 74 68 |ing, we |would th|
|00003d00| 65 6e 20 68 61 76 65 20 | 73 6f 6d 65 20 73 6f 72 |en have |some sor|
|00003d10| 74 20 6f 66 20 6c 6f 6f | 70 2c 20 73 75 63 68 20 |t of loo|p, such |
|00003d20| 61 73 3a 0d 0d 20 20 20 | 20 41 73 73 75 6d 65 20 |as:.. | Assume |
|00003d30| 74 68 65 20 6c 6f 63 61 | 74 69 6f 6e 20 77 68 65 |the loca|tion whe|
|00003d40| 72 65 20 74 68 65 20 75 | 73 65 72 20 63 6c 69 63 |re the u|ser clic|
|00003d50| 6b 65 64 20 69 73 20 61 | 6c 72 65 61 64 79 20 69 |ked is a|lready i|
|00003d60| 6e 20 6d 6f 75 73 65 4c | 6f 63 2c 20 6c 6f 63 61 |n mouseL|oc, loca|
|00003d70| 6c 20 63 6f 6f 72 64 69 | 6e 61 74 65 73 2e 0d 0d |l coordi|nates...|
|00003d80| 20 20 20 20 69 66 20 28 | 65 72 72 29 20 72 65 74 | if (|err) ret|
|00003d90| 75 72 6e 3b 20 20 20 20 | 20 20 20 20 4e 6f 20 72 |urn; | No r|
|00003da0| 61 6d 20 66 6f 72 20 74 | 68 65 20 6f 66 66 73 63 |am for t|he offsc|
|00003db0| 72 65 65 6e 20 73 74 75 | 66 66 2e 0d 0d 20 20 20 |reen stu|ff... |
|00003dc0| 20 6c 61 73 74 4c 6f 63 | 2e 68 20 3d 20 6c 61 73 | lastLoc|.h = las|
|00003dd0| 74 4c 6f 63 2e 76 20 3d | 20 2d 33 32 37 36 37 3b |tLoc.v =| -32767;|
|00003de0| 20 20 20 20 20 55 6e 63 | 6c 69 63 6b 61 62 6c 65 | Unc|lickable|
|00003df0| 20 69 6e 69 74 69 61 6c | 20 70 6f 69 6e 74 2e 0d | initial| point..|
|00003e00| 20 20 20 20 77 68 69 6c | 65 20 28 53 74 69 6c 6c | whil|e (Still|
|00003e10| 44 6f 77 6e 28 29 29 20 | 7b 0d 20 20 20 20 20 20 |Down()) |{. |
|00003e20| 20 20 69 66 20 28 28 6c | 61 73 74 4c 6f 63 2e 68 | if ((l|astLoc.h|
|00003e30| 20 21 3d 20 6d 6f 75 73 | 65 4c 6f 63 2e 68 29 20 | != mous|eLoc.h) |
|00003e40| 7c 7c 20 28 6c 61 73 74 | 4c 6f 63 2e 76 20 21 3d ||| (last|Loc.v !=|
|00003e50| 20 6d 6f 75 73 65 4c 6f | 63 2e 76 29 29 20 7b 20 | mouseLo|c.v)) { |
|00003e60| 20 41 6c 77 61 79 73 20 | 74 72 75 65 20 66 69 72 | Always |true fir|
|00003e70| 73 74 20 74 69 6d 65 2e | 0d 20 20 20 20 20 20 20 |st time.|. |
|00003e80| 20 20 20 20 20 72 63 74 | 2e 74 6f 70 20 20 3d 20 | rct|.top = |
|00003e90| 72 63 74 2e 62 6f 74 74 | 6f 6d 20 3d 20 6d 6f 75 |rct.bott|om = mou|
|00003ea0| 73 65 4c 6f 63 2e 76 3b | 0d 20 20 20 20 20 20 20 |seLoc.v;|. |
|00003eb0| 20 20 20 20 20 72 63 74 | 2e 6c 65 66 74 20 3d 20 | rct|.left = |
|00003ec0| 72 63 74 2e 72 69 67 68 | 74 20 20 3d 20 6d 6f 75 |rct.righ|t = mou|
|00003ed0| 73 65 4c 6f 63 2e 68 3b | 0d 20 20 20 20 20 20 20 |seLoc.h;|. |
|00003ee0| 20 20 20 20 20 72 63 74 | 2e 62 6f 74 74 6f 6d 20 | rct|.bottom |
|00003ef0| 2b 3d 20 6d 79 49 6e 66 | 6f 2e 6f 62 6a 65 63 74 |+= myInf|o.object|
|00003f00| 48 65 69 67 68 74 3b 0d | 20 20 20 20 20 20 20 20 |Height;.| |
|00003f10| 20 20 20 20 72 63 74 2e | 72 69 67 68 74 20 20 2b | rct.|right +|
|00003f20| 3d 20 6d 79 49 6e 66 6f | 2e 6f 62 6a 65 63 74 57 |= myInfo|.objectW|
|00003f30| 69 64 74 68 3b 0d 20 20 | 20 20 20 20 20 20 20 20 |idth;. | |
|00003f40| 20 20 49 6e 76 61 6c 4c | 61 79 65 72 28 77 69 6e | InvalL|ayer(win|
|00003f50| 64 6f 77 4c 61 79 65 72 | 2c 20 72 63 74 2c 20 74 |dowLayer|, rct, t|
|00003f60| 72 75 65 29 3b 20 20 20 | 20 20 55 70 64 61 74 65 |rue); | Update|
|00003f70| 20 6c 61 73 74 20 6c 6f | 63 61 74 69 6f 6e 2c 20 | last lo|cation, |
|00003f80| 61 73 20 77 65 6c 6c 20 | 61 73 20 74 68 69 73 20 |as well |as this |
|00003f90| 6f 6e 65 2e 0d 20 20 20 | 20 20 20 20 20 20 20 20 |one.. | |
|00003fa0| 20 55 70 64 61 74 65 4c | 61 79 65 72 28 77 69 6e | UpdateL|ayer(win|
|00003fb0| 64 6f 77 4c 61 79 65 72 | 29 3b 0d 20 20 20 20 20 |dowLayer|);. |
|00003fc0| 20 20 20 20 20 20 20 6c | 61 73 74 4c 6f 63 20 3d | l|astLoc =|
|00003fd0| 20 6d 6f 75 73 65 4c 6f | 63 3b 0d 20 20 20 20 20 | mouseLo|c;. |
|00003fe0| 20 20 20 7d 0d 20 20 20 | 20 7d 0d 0d 20 20 20 20 | }. | }.. |
|00003ff0| 44 69 73 70 6f 73 65 54 | 68 69 73 41 6e 64 42 65 |DisposeT|hisAndBe|
|00004000| 6c 6f 77 4c 61 79 65 72 | 73 28 77 69 6e 64 6f 77 |lowLayer|s(window|
|00004010| 4c 61 79 65 72 29 3b 0d | 0d 41 73 20 63 61 6e 20 |Layer);.|.As can |
|00004020| 62 65 20 73 65 65 6e 20 | 61 62 6f 76 65 2c 20 73 |be seen |above, s|
|00004030| 6d 6f 6f 74 68 6c 79 20 | 64 72 61 67 67 69 6e 67 |moothly |dragging|
|00004040| 20 61 6e 20 6f 62 6a 65 | 63 74 20 63 61 6e 20 62 | an obje|ct can b|
|00004050| 65 20 76 65 72 79 20 6c | 69 74 74 6c 65 20 63 6f |e very l|ittle co|
|00004060| 64 65 2e 20 20 54 68 65 | 72 65 20 61 72 65 20 61 |de. The|re are a|
|00004070| 20 66 65 77 0d 74 68 69 | 6e 67 73 20 6e 6f 74 20 | few.thi|ngs not |
|00004080| 68 61 6e 64 6c 65 64 20 | 62 79 20 74 68 65 20 61 |handled |by the a|
|00004090| 62 6f 76 65 20 63 6f 64 | 65 2c 20 73 75 63 68 20 |bove cod|e, such |
|000040a0| 61 73 20 69 66 20 74 68 | 65 72 65 20 69 73 6e 27 |as if th|ere isn'|
|000040b0| 74 20 65 6e 6f 75 67 68 | 20 6d 65 6d 6f 72 79 20 |t enough| memory |
|000040c0| 66 6f 72 20 74 68 65 20 | 6f 66 66 73 63 72 65 65 |for the |offscree|
|000040d0| 6e 0d 47 57 6f 72 6c 64 | 73 2e 20 20 49 74 20 69 |n.GWorld|s. It i|
|000040e0| 73 6e 27 74 20 72 65 61 | 6c 6c 79 20 70 6f 6c 69 |sn't rea|lly poli|
|000040f0| 74 65 20 74 6f 20 64 6f | 20 6e 6f 74 68 69 6e 67 |te to do| nothing|
|00004100| 2c 20 61 73 20 74 68 65 | 20 61 62 6f 76 65 20 63 |, as the| above c|
|00004110| 6f 64 65 20 64 6f 65 73 | 2e 20 20 46 6f 72 20 65 |ode does|. For e|
|00004120| 78 63 65 70 74 69 6f 6e | 0d 68 61 6e 64 6c 69 6e |xception|.handlin|
|00004130| 67 2c 20 70 6c 65 61 73 | 65 20 73 65 65 20 74 68 |g, pleas|e see th|
|00004140| 65 20 61 63 74 75 61 6c | 20 73 61 6d 70 6c 65 20 |e actual| sample |
|00004150| 63 6f 64 65 20 74 68 61 | 74 20 75 73 65 73 20 74 |code tha|t uses t|
|00004160| 68 65 20 47 57 4c 61 79 | 65 72 73 2e 63 20 70 61 |he GWLay|ers.c pa|
|00004170| 63 6b 61 67 65 2e 20 0d | 0d 0d 01 2e 00 0f 00 00 |ckage. .|........|
|00004180| 00 00 00 0b 00 09 00 04 | 00 00 00 09 00 00 00 00 |........|........|
|00004190| 00 00 00 00 1c 63 00 0b | 00 09 00 04 05 00 00 09 |.....c..|........|
|000041a0| 00 00 00 00 00 00 00 00 | 1c 6e 00 0b 00 09 00 04 |........|.n......|
|000041b0| 00 00 00 09 00 00 00 00 | 00 00 00 00 26 01 00 0b |........|....&...|
|000041c0| 00 09 00 04 05 00 00 09 | 00 00 00 00 00 00 00 00 |........|........|
|000041d0| 26 0b 00 0b 00 09 00 04 | 00 00 00 09 00 00 00 00 |&.......|........|
|000041e0| 00 00 00 00 26 0e 00 0b | 00 09 00 04 05 00 00 09 |....&...|........|
|000041f0| 00 00 00 00 00 00 00 00 | 26 18 00 0b 00 09 00 04 |........|&.......|
|00004200| 00 00 00 09 00 00 00 00 | 00 00 00 00 27 75 00 0b |........|....'u..|
|00004210| 00 09 00 04 05 00 00 09 | 00 00 00 00 00 00 00 00 |........|........|
|00004220| 27 80 00 0b 00 09 00 04 | 00 00 00 09 00 00 00 00 |'.......|........|
|00004230| 00 00 00 00 3b e2 00 0b | 00 09 00 04 05 00 00 09 |....;...|........|
|00004240| 00 00 00 00 00 00 00 00 | 3b ec 00 0b 00 09 00 04 |........|;.......|
|00004250| 00 00 00 09 00 00 00 00 | 00 00 00 00 3c 41 00 0b |........|....<A..|
|00004260| 00 09 00 04 05 00 00 09 | 00 00 00 00 00 00 00 00 |........|........|
|00004270| 3c 4c 00 0b 00 09 00 04 | 00 00 00 09 00 00 00 00 |<L......|........|
|00004280| 00 00 00 00 3c 90 00 0b | 00 09 00 04 05 00 00 09 |....<...|........|
|00004290| 00 00 00 00 00 00 00 00 | 3c a9 00 0b 00 09 00 04 |........|<.......|
|000042a0| 00 00 00 09 00 00 00 00 | 00 00 |........|.. |
+--------+-------------------------+-------------------------+--------+--------+